Chore: split SOCKS version inbound metadata type (#1513)

This commit is contained in:
gVisor bot 2021-07-27 13:58:29 +08:00
parent 44360ef29b
commit 6ba3a17d7b
3 changed files with 8 additions and 5 deletions

View file

@ -17,7 +17,8 @@ const (
HTTP Type = iota
HTTPCONNECT
SOCKS
SOCKS4
SOCKS5
REDIR
TPROXY
)
@ -43,7 +44,9 @@ func (t Type) String() string {
return "HTTP"
case HTTPCONNECT:
return "HTTP Connect"
case SOCKS:
case SOCKS4:
return "Socks4"
case SOCKS5:
return "Socks5"
case REDIR:
return "Redir"

View file

@ -79,7 +79,7 @@ func HandleSocks4(conn net.Conn, in chan<- C.ConnContext) {
if c, ok := conn.(*net.TCPConn); ok {
c.SetKeepAlive(true)
}
in <- inbound.NewSocket(socks5.ParseAddr(addr), conn, C.SOCKS)
in <- inbound.NewSocket(socks5.ParseAddr(addr), conn, C.SOCKS4)
}
func HandleSocks5(conn net.Conn, in chan<- C.ConnContext) {
@ -96,5 +96,5 @@ func HandleSocks5(conn net.Conn, in chan<- C.ConnContext) {
io.Copy(ioutil.Discard, conn)
return
}
in <- inbound.NewSocket(target, conn, C.SOCKS)
in <- inbound.NewSocket(target, conn, C.SOCKS5)
}

View file

@ -70,7 +70,7 @@ func handleSocksUDP(pc net.PacketConn, in chan<- *inbound.PacketAdapter, buf []b
bufRef: buf,
}
select {
case in <- inbound.NewPacket(target, packet, C.SOCKS):
case in <- inbound.NewPacket(target, packet, C.SOCKS5):
default:
}
}