Chore: Merge branch 'ogn-dev' into with-tun

This commit is contained in:
yaling888
2022-03-16 20:16:30 +08:00
74 changed files with 675 additions and 281 deletions

View File

@ -108,7 +108,7 @@ func authenticate(request *http.Request, cache *cache.Cache) *http.Response {
return resp
}
var authed interface{}
var authed any
if authed = cache.Get(credential); authed == nil {
user, pass, err := decodeBasicProxyAuthorization(credential)
authed = err == nil && authenticator.Verify(user, pass)

View File

@ -65,10 +65,10 @@ func decodeBasicProxyAuthorization(credential string) (string, string, error) {
return "", "", err
}
login := strings.Split(string(plain), ":")
if len(login) != 2 {
user, pass, found := strings.Cut(string(plain), ":")
if !found {
return "", "", errors.New("invalid login")
}
return login[0], login[1], nil
return user, pass, nil
}

View File

@ -1,5 +1,4 @@
//go:build linux && !386
// +build linux,!386
package redir

View File

@ -1,5 +1,4 @@
//go:build !darwin && !linux && !freebsd
// +build !darwin,!linux,!freebsd
package redir

View File

@ -1,5 +1,4 @@
//go:build linux
// +build linux
package tproxy

View File

@ -1,5 +1,4 @@
//go:build !linux
// +build !linux
package tproxy

View File

@ -1,5 +1,4 @@
//go:build linux
// +build linux
package tproxy

View File

@ -1,5 +1,4 @@
//go:build !linux
// +build !linux
package tproxy