From 3c9a86e16ca9ba09ae2797b02094a81501651a8a Mon Sep 17 00:00:00 2001 From: jkito <belter@riseup.net> Date: Thu, 1 Aug 2024 00:32:51 +0530 Subject: [PATCH] obfs4: filter out kcp bridges when transport is obfs4 in case of KCP the transport.Type is still obfs4, but it has a different port than obfs4, without this commit KCP enabled bridges were also considered as valid obfs4 bridges in theory the same bridge can be running in both obfs4 and KCP mode and listening on different ports, but the eip-service.json schema separates this into different transport objects this fixes a bug where after selecting obfs4 transport it was trying connect to a KCP enabled bridge with plain obfs4 mode --- pkg/vpn/bonafide/gateways.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/vpn/bonafide/gateways.go b/pkg/vpn/bonafide/gateways.go index c9e6e8b3..22a1bf8b 100644 --- a/pkg/vpn/bonafide/gateways.go +++ b/pkg/vpn/bonafide/gateways.go @@ -66,6 +66,9 @@ func (gw Gateway) isTransport(transport string) bool { if transport == "kcp" { return gw.Transport == "obfs4" && slices.Contains(gw.Protocols, "kcp") } + if transport == "obfs4" { + return gw.Transport == "obfs4" && !slices.Contains(gw.Protocols, "kcp") + } return transport == "any" || gw.Transport == transport } -- GitLab