parent
d2d899d157
commit
8968f7dd74
2 changed files with 62 additions and 32 deletions
|
@ -67,6 +67,8 @@ type config struct {
|
|||
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
||||
DisableRPC bool `long:"norpc" description:"Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass is specified"`
|
||||
DisableDNSSeed bool `long:"nodnsseed" description:"Disable DNS seeding for peers"`
|
||||
ExternalIPs []string `long:"externalip" description:"Add an ip
|
||||
to the list of local addresses we claim to listen on to peers"`
|
||||
Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
||||
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
|
||||
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
|
||||
|
|
28
server.go
28
server.go
|
@ -828,6 +828,28 @@ func newServer(listenAddrs []string, db btcdb.Db, btcnet btcwire.BitcoinNet) (*s
|
|||
return nil, err
|
||||
}
|
||||
listeners = make([]net.Listener, 0, len(ipv4Addrs)+len(ipv6Addrs))
|
||||
discover := true
|
||||
if len(cfg.ExternalIPs) != 0 {
|
||||
discover = false
|
||||
port, err :=
|
||||
strconv.ParseUint(activeNetParams.listenPort,
|
||||
10, 16)
|
||||
if err != nil {
|
||||
srvrLog.Warnf("doubleewteeeff?")
|
||||
}
|
||||
|
||||
for _, sip := range cfg.ExternalIPs {
|
||||
na, err := hostToNetAddress(sip, uint16(port),
|
||||
btcwire.SFNodeNetwork)
|
||||
if err != nil {
|
||||
srvrLog.Warnf("Not adding %s as ip: %v",
|
||||
sip, err)
|
||||
continue
|
||||
}
|
||||
|
||||
amgr.addLocalAddress(na, ManualPrio)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(oga) nonstandard port...
|
||||
if wildcard {
|
||||
|
@ -846,9 +868,11 @@ func newServer(listenAddrs []string, db btcdb.Db, btcnet btcwire.BitcoinNet) (*s
|
|||
}
|
||||
na := btcwire.NewNetAddressIPPort(ip,
|
||||
uint16(port), btcwire.SFNodeNetwork)
|
||||
if discover {
|
||||
amgr.addLocalAddress(na, InterfacePrio)
|
||||
}
|
||||
}
|
||||
}
|
||||
nowc:
|
||||
|
||||
for _, addr := range ipv4Addrs {
|
||||
|
@ -860,10 +884,12 @@ func newServer(listenAddrs []string, db btcdb.Db, btcnet btcwire.BitcoinNet) (*s
|
|||
}
|
||||
listeners = append(listeners, listener)
|
||||
|
||||
if discover {
|
||||
if na, err := deserialiseNetAddress(addr); err == nil {
|
||||
amgr.addLocalAddress(na, BoundPrio)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, addr := range ipv6Addrs {
|
||||
listener, err := net.Listen("tcp6", addr)
|
||||
|
@ -873,10 +899,12 @@ func newServer(listenAddrs []string, db btcdb.Db, btcnet btcwire.BitcoinNet) (*s
|
|||
continue
|
||||
}
|
||||
listeners = append(listeners, listener)
|
||||
if discover {
|
||||
if na, err := deserialiseNetAddress(addr); err == nil {
|
||||
amgr.addLocalAddress(na, BoundPrio)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(listeners) == 0 {
|
||||
return nil, errors.New("No valid listen address")
|
||||
|
|
Loading…
Add table
Reference in a new issue