diff --git a/connmgr/connmanager.go b/connmgr/connmanager.go index 26548fe9..614185cc 100644 --- a/connmgr/connmanager.go +++ b/connmgr/connmanager.go @@ -37,12 +37,6 @@ var ( defaultTargetOutbound = uint32(8) ) -// DialFunc defines a function that dials a connection. -type DialFunc func(string, string) (net.Conn, error) - -// AddressFunc defines a function that returns a network address to connect to. -type AddressFunc func() (string, error) - // ConnState represents the state of the requested connection. type ConnState uint8 @@ -57,14 +51,6 @@ const ( ConnFailed ) -// OnConnectionFunc is the signature of the callback function which is used to -// subscribe to new connections. -type OnConnectionFunc func(*ConnReq, net.Conn) - -// OnDisconnectionFunc is the signature of the callback function which is used to -// notify disconnections. -type OnDisconnectionFunc func(*ConnReq) - // ConnReq is the connection request to a network address. If permanent, the // connection will be retried on disconnection. type ConnReq struct { @@ -118,20 +104,20 @@ type Config struct { // requests. Defaults to 5s. RetryDuration time.Duration - // OnConnection is a callback that is fired when a new connection is - // established. - OnConnection OnConnectionFunc + // OnConnection is a callback that is fired when a new outbound + // connection is established. + OnConnection func(*ConnReq, net.Conn) - // OnDisconnection is a callback that is fired when a connection is - // disconnected. - OnDisconnection OnDisconnectionFunc + // OnDisconnection is a callback that is fired when an outbound + // connection is disconnected. + OnDisconnection func(*ConnReq) // GetNewAddress is a way to get an address to make a network connection // to. If nil, no new connections will be made automatically. - GetNewAddress AddressFunc + GetNewAddress func() (string, error) // Dial connects to the address on the named network. It cannot be nil. - Dial DialFunc + Dial func(string, string) (net.Conn, error) } // handleConnected is used to queue a successful connection. diff --git a/server.go b/server.go index d111058c..69c32a2a 100644 --- a/server.go +++ b/server.go @@ -2426,7 +2426,7 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param // specified peers and actively avoid advertising and connecting to // discovered peers in order to prevent it from becoming a public test // network. - var newAddressFunc connmgr.AddressFunc + var newAddressFunc func() (string, error) if !cfg.SimNet && len(cfg.ConnectPeers) == 0 { newAddressFunc = func() (string, error) { for tries := 0; tries < 100; tries++ {