mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-19 08:20:05 +08:00
chore: unconditionally allow clients with passwords for password-free socks5 inbound (#2123)
This commit is contained in:
parent
2c55dc2557
commit
5c6aa433ca
@ -41,3 +41,11 @@ func NewAuthenticator(users []AuthUser) Authenticator {
|
||||
}
|
||||
return au
|
||||
}
|
||||
|
||||
var AlwaysValid Authenticator = alwaysValid{}
|
||||
|
||||
type alwaysValid struct{}
|
||||
|
||||
func (alwaysValid) Verify(string, string) bool { return true }
|
||||
|
||||
func (alwaysValid) Users() []string { return nil }
|
||||
|
||||
@ -118,6 +118,10 @@ func ServerHandshake(rw net.Conn, authenticator auth.Authenticator) (addr Addr,
|
||||
return
|
||||
}
|
||||
|
||||
if nmethods == 1 && buf[0] == 0x02 /* will use password */ && authenticator == nil {
|
||||
authenticator = auth.AlwaysValid
|
||||
}
|
||||
|
||||
// write VER METHOD
|
||||
if authenticator != nil {
|
||||
if _, err = rw.Write([]byte{5, 2}); err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user