mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-05 08:29:03 +00:00
Move socks config into a sparate folder
This commit is contained in:
1 parent
3747e45978
commit
13e595e4cb
3 files changed
+35
-26
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
const (
|
||||
AuthMethodNoAuth = "noauth"
|
||||
AuthMethodUserPass = "password"
|
||||
)
|
||||
|
||||
type SocksConfig struct {
|
||||
AuthMethod string `json:"auth"`
|
||||
Username string `json:"user"`
|
||||
Password string `json:"pass"`
|
||||
}
|
||||
|
||||
func (config SocksConfig) IsNoAuth() bool {
|
||||
return config.AuthMethod == AuthMethodNoAuth
|
||||
}
|
||||
|
||||
func (config SocksConfig) IsPassword() bool {
|
||||
return config.AuthMethod == AuthMethodUserPass
|
||||
}
|
||||
|
||||
func Load(rawConfig []byte) (SocksConfig, error) {
|
||||
config := SocksConfig{}
|
||||
err := json.Unmarshal(rawConfig, &config)
|
||||
return config, err
|
||||
}
|
||||
Reference in new issue
Block a user