From 9a543488914e3b4e5e5d868bd7a6130745d8052a Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 13 Aug 2023 21:27:48 +0100 Subject: [PATCH] Improve check --- src/admin/getpeers.go | 2 +- src/core/link_tcp_mptcp_go121.go | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/admin/getpeers.go b/src/admin/getpeers.go index b6893f794..dc0a72978 100644 --- a/src/admin/getpeers.go +++ b/src/admin/getpeers.go @@ -24,7 +24,7 @@ type PeerEntry struct { PublicKey string `json:"key"` Port uint64 `json:"port"` Priority uint64 `json:"priority"` - Multipath bool `json:"multipath"` + Multipath bool `json:"multipath,omitempty"` RXBytes DataUnit `json:"bytes_recvd,omitempty"` TXBytes DataUnit `json:"bytes_sent,omitempty"` Uptime float64 `json:"uptime,omitempty"` diff --git a/src/core/link_tcp_mptcp_go121.go b/src/core/link_tcp_mptcp_go121.go index ccb928fb2..3e0b727b9 100644 --- a/src/core/link_tcp_mptcp_go121.go +++ b/src/core/link_tcp_mptcp_go121.go @@ -22,8 +22,11 @@ func isMPTCP(c net.Conn) bool { mp, _ := tc.MultipathTCP() return mp case *tls.Conn: - mp, _ := tc.NetConn().(*net.TCPConn).MultipathTCP() - return mp + if tc, ok := tc.NetConn().(*net.TCPConn); ok { + mp, _ := tc.MultipathTCP() + return mp + } + return false default: return false }