Chore: split SOCKS version inbound metadata type (#1513)
This commit is contained in:
parent
44360ef29b
commit
6ba3a17d7b
3 changed files with 8 additions and 5 deletions
|
@ -17,7 +17,8 @@ const (
|
||||||
|
|
||||||
HTTP Type = iota
|
HTTP Type = iota
|
||||||
HTTPCONNECT
|
HTTPCONNECT
|
||||||
SOCKS
|
SOCKS4
|
||||||
|
SOCKS5
|
||||||
REDIR
|
REDIR
|
||||||
TPROXY
|
TPROXY
|
||||||
)
|
)
|
||||||
|
@ -43,7 +44,9 @@ func (t Type) String() string {
|
||||||
return "HTTP"
|
return "HTTP"
|
||||||
case HTTPCONNECT:
|
case HTTPCONNECT:
|
||||||
return "HTTP Connect"
|
return "HTTP Connect"
|
||||||
case SOCKS:
|
case SOCKS4:
|
||||||
|
return "Socks4"
|
||||||
|
case SOCKS5:
|
||||||
return "Socks5"
|
return "Socks5"
|
||||||
case REDIR:
|
case REDIR:
|
||||||
return "Redir"
|
return "Redir"
|
||||||
|
|
|
@ -79,7 +79,7 @@ func HandleSocks4(conn net.Conn, in chan<- C.ConnContext) {
|
||||||
if c, ok := conn.(*net.TCPConn); ok {
|
if c, ok := conn.(*net.TCPConn); ok {
|
||||||
c.SetKeepAlive(true)
|
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) {
|
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)
|
io.Copy(ioutil.Discard, conn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
in <- inbound.NewSocket(target, conn, C.SOCKS)
|
in <- inbound.NewSocket(target, conn, C.SOCKS5)
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ func handleSocksUDP(pc net.PacketConn, in chan<- *inbound.PacketAdapter, buf []b
|
||||||
bufRef: buf,
|
bufRef: buf,
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case in <- inbound.NewPacket(target, packet, C.SOCKS):
|
case in <- inbound.NewPacket(target, packet, C.SOCKS5):
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue