mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
cmd/strelaypoolsrv: Ability to select listen protocol
This commit is contained in:
parent
81f683a61c
commit
1de787fab8
@ -76,6 +76,7 @@ var (
|
|||||||
permRelaysFile string
|
permRelaysFile string
|
||||||
ipHeader string
|
ipHeader string
|
||||||
geoipPath string
|
geoipPath string
|
||||||
|
proto string
|
||||||
|
|
||||||
getMut = sync.NewRWMutex()
|
getMut = sync.NewRWMutex()
|
||||||
getLRUCache *lru.Cache
|
getLRUCache *lru.Cache
|
||||||
@ -105,6 +106,7 @@ func main() {
|
|||||||
flag.StringVar(&permRelaysFile, "perm-relays", "", "Path to list of permanent relays")
|
flag.StringVar(&permRelaysFile, "perm-relays", "", "Path to list of permanent relays")
|
||||||
flag.StringVar(&ipHeader, "ip-header", "", "Name of header which holds clients ip:port. Only meaningful when running behind a reverse proxy.")
|
flag.StringVar(&ipHeader, "ip-header", "", "Name of header which holds clients ip:port. Only meaningful when running behind a reverse proxy.")
|
||||||
flag.StringVar(&geoipPath, "geoip", "GeoLite2-City.mmdb", "Path to GeoLite2-City database")
|
flag.StringVar(&geoipPath, "geoip", "GeoLite2-City.mmdb", "Path to GeoLite2-City database")
|
||||||
|
flag.StringVar(&proto, "protocol", "tcp", "Protocol used for listening. 'tcp' for IPv4 and IPv6, 'tcp4' for IPv4, 'tcp6' for IPv6")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@ -154,12 +156,12 @@ func main() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
listener, err = tls.Listen("tcp", listen, tlsCfg)
|
listener, err = tls.Listen(proto, listen, tlsCfg)
|
||||||
} else {
|
} else {
|
||||||
if debug {
|
if debug {
|
||||||
log.Println("Starting plain listener on", listen)
|
log.Println("Starting plain listener on", listen)
|
||||||
}
|
}
|
||||||
listener, err = net.Listen("tcp", listen)
|
listener, err = net.Listen(proto, listen)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user