Feature: add Mixed(http+socks5) proxy listening (#685)
This commit is contained in:
@ -36,7 +36,7 @@ func NewSocksProxy(addr string) (*SockListener, error) {
|
||||
}
|
||||
continue
|
||||
}
|
||||
go handleSocks(c)
|
||||
go HandleSocks(c)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -52,13 +52,15 @@ func (l *SockListener) Address() string {
|
||||
return l.address
|
||||
}
|
||||
|
||||
func handleSocks(conn net.Conn) {
|
||||
func HandleSocks(conn net.Conn) {
|
||||
target, command, err := socks5.ServerHandshake(conn, authStore.Authenticator())
|
||||
if err != nil {
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
conn.(*net.TCPConn).SetKeepAlive(true)
|
||||
if c, ok := conn.(*net.TCPConn); ok {
|
||||
c.SetKeepAlive(true)
|
||||
}
|
||||
if command == socks5.CmdUDPAssociate {
|
||||
defer conn.Close()
|
||||
io.Copy(ioutil.Discard, conn)
|
||||
|
Reference in New Issue
Block a user