From 0ee1146e1c996e9056c9ae0af71a6cec4cf9388b Mon Sep 17 00:00:00 2001 From: AudriusButkevicius Date: Tue, 7 Nov 2017 07:25:05 +0000 Subject: [PATCH] lib/connections: Indicate stack in transport (fixes #4463) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4486 --- lib/connections/structs.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/connections/structs.go b/lib/connections/structs.go index 0a044d0b..7e678a8c 100644 --- a/lib/connections/structs.go +++ b/lib/connections/structs.go @@ -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 {