mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Chore: split SOCKS version inbound metadata type (#1513)
This commit is contained in:
parent
44360ef29b
commit
6ba3a17d7b
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user