mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-14 14:09:22 +00:00
chore: Add InUser for http/socks/mixed
This commit is contained in:
@@ -43,7 +43,7 @@ var (
|
||||
|
||||
var subnet = netip.PrefixFrom(netip.IPv4Unspecified(), 24)
|
||||
|
||||
func ServerHandshake(rw io.ReadWriter, authenticator auth.Authenticator) (addr string, command Command, err error) {
|
||||
func ServerHandshake(rw io.ReadWriter, authenticator auth.Authenticator) (addr string, command Command, user string, err error) {
|
||||
var req [8]byte
|
||||
if _, err = io.ReadFull(rw, req[:]); err != nil {
|
||||
return
|
||||
@@ -73,6 +73,7 @@ func ServerHandshake(rw io.ReadWriter, authenticator auth.Authenticator) (addr s
|
||||
if userID, err = readUntilNull(rw); err != nil {
|
||||
return
|
||||
}
|
||||
user = string(userID)
|
||||
|
||||
if isReservedIP(dstIP) {
|
||||
var target []byte
|
||||
@@ -90,7 +91,7 @@ func ServerHandshake(rw io.ReadWriter, authenticator auth.Authenticator) (addr s
|
||||
}
|
||||
|
||||
// SOCKS4 only support USERID auth.
|
||||
if authenticator == nil || authenticator.Verify(string(userID), "") {
|
||||
if authenticator == nil || authenticator.Verify(user, "") {
|
||||
code = RequestGranted
|
||||
} else {
|
||||
code = RequestIdentdMismatched
|
||||
|
||||
Reference in New Issue
Block a user