multi: Added a NetInterface to clean up config.go
This commit adds a new interface named NetInterface and two implementations of it: RegularNet & TorProxyNet. These two structs are used in config.go in an attempt to clean up the code and abstract away the dialer and DNS functions.
This commit is contained in:
1 parent
e132ad8433
commit
8c482f2be7
6 files changed
+99
-87
No files matched your search
+2
-3
@@ -38,11 +38,10 @@ func Dial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress,
|
||||
var conn net.Conn
|
||||
var err error
|
||||
if dialer == nil {
|
||||
// A Tor proxy dial function WAS NOT passed in.
|
||||
// A dial function WAS NOT passed in.
|
||||
conn, err = net.Dial("tcp", ipAddr)
|
||||
} else {
|
||||
// A Tor proxy dial function WAS passed in so we use it instead
|
||||
// of golang's net.Dial.
|
||||
// A dial function WAS passed in so we use it instead.
|
||||
conn, err = dialer[0]("tcp", ipAddr)
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user