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

This commit is contained in:
xᴊᴀsᴏɴʟʏᴜ 2021-07-27 13:58:29 +08:00 committed by GitHub
parent 09697b7679
commit 3705996974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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:
}
}