mirror of
https://github.com/luscis/openlan.git
synced 2025-10-16 14:00:42 +08:00
fea: support forwarding socks5.
This commit is contained in:
@@ -22,15 +22,20 @@ func NewSocksProxy(cfg *config.SocksProxy) *SocksProxy {
|
||||
// Create a SOCKS5 server
|
||||
auth := cfg.Auth
|
||||
authMethods := make([]socks5.Authenticator, 0, 2)
|
||||
if len(auth.Username) > 0 {
|
||||
if auth != nil && len(auth.Username) > 0 {
|
||||
author := socks5.UserPassAuthenticator{
|
||||
Credentials: socks5.StaticCredentials{
|
||||
auth.Username: auth.Password,
|
||||
},
|
||||
}
|
||||
authMethods = append(authMethods, author)
|
||||
|
||||
}
|
||||
conf := &socks5.Config{
|
||||
Backends: cfg.Backends,
|
||||
AuthMethods: authMethods,
|
||||
Logger: s.out,
|
||||
}
|
||||
conf := &socks5.Config{AuthMethods: authMethods}
|
||||
server, err := socks5.New(conf)
|
||||
if err != nil {
|
||||
s.out.Error("NewSocksProxy %s", err)
|
||||
|
Reference in New Issue
Block a user