MCPcopy Create free account
hub / github.com/celzero/midway / tcp4or6

Function tcp4or6

midway/relay/proxy.go:197–207  ·  view source on GitHub ↗

always "tcp" for now, because for web properties that are ipv4-only cause connect-timeouts from incoming ipv6 connections. Instead of specifically returning "tcp6", we now let it be "tcp".

(a net.Addr)

Source from the content-addressed store, hash-verified

195// cause connect-timeouts from incoming ipv6 connections. Instead of
196// specifically returning "tcp6", we now let it be "tcp".
197func tcp4or6(a net.Addr) (string, error) {
198 if addrport, err := netip.ParseAddrPort(a.String()); err == nil {
199 if addrport.Addr().Is6() || addrport.Addr().Is4In6() {
200 return /*tcp6*/ "tcp", nil
201 } else {
202 return /*tcp4*/ "tcp", nil
203 }
204 } else {
205 return "tcp", err
206 }
207}
208
209func underlyingConn(c net.Conn) net.Conn {
210 if wrap, ok := c.(*Conn); ok {

Callers 1

NewProxyConnFunction · 0.85

Calls 1

AddrMethod · 0.80

Tested by

no test coverage detected