lib/connections: Indicate stack in transport (fixes #4463)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4486
This commit is contained in:
AudriusButkevicius 2017-11-07 07:25:05 +00:00 committed by Jakob Borg
parent 88180904f2
commit 0ee1146e1c

View File

@ -93,7 +93,19 @@ func (c internalConn) Type() string {
}
func (c internalConn) Transport() string {
return c.connType.Transport()
transport := c.connType.Transport()
host, _, err := net.SplitHostPort(c.LocalAddr().String())
if err != nil {
return transport
}
ip := net.ParseIP(host)
if ip == nil {
return transport
}
if ip.To4() != nil {
return transport + "4"
}
return transport + "6"
}
func (c internalConn) String() string {