mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
lib/connection: Remove unused functions
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3110
This commit is contained in:
parent
ee94d53bda
commit
cd05282369
@ -179,40 +179,6 @@ func (tcpListenerFactory) Enabled(cfg config.Configuration) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func isPublicIPv4(ip net.IP) bool {
|
|
||||||
ip = ip.To4()
|
|
||||||
if ip == nil {
|
|
||||||
// Not an IPv4 address (IPv6)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsGlobalUnicast below only checks that it's not link local or
|
|
||||||
// multicast, and we want to exclude private (NAT:ed) addresses as well.
|
|
||||||
rfc1918 := []net.IPNet{
|
|
||||||
{IP: net.IP{10, 0, 0, 0}, Mask: net.IPMask{255, 0, 0, 0}},
|
|
||||||
{IP: net.IP{172, 16, 0, 0}, Mask: net.IPMask{255, 240, 0, 0}},
|
|
||||||
{IP: net.IP{192, 168, 0, 0}, Mask: net.IPMask{255, 255, 0, 0}},
|
|
||||||
}
|
|
||||||
for _, n := range rfc1918 {
|
|
||||||
if n.Contains(ip) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ip.IsGlobalUnicast()
|
|
||||||
}
|
|
||||||
|
|
||||||
func isPublicIPv6(ip net.IP) bool {
|
|
||||||
if ip.To4() != nil {
|
|
||||||
// Not an IPv6 address (IPv4)
|
|
||||||
// (To16() returns a v6 mapped v4 address so can't be used to check
|
|
||||||
// that it's an actual v6 address)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return ip.IsGlobalUnicast()
|
|
||||||
}
|
|
||||||
|
|
||||||
func fixupPort(uri *url.URL) *url.URL {
|
func fixupPort(uri *url.URL) *url.URL {
|
||||||
copyURI := *uri
|
copyURI := *uri
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user