config.go 402 B

12345678910111213141516171819202122
  1. package socks
  2. import (
  3. "encoding/json"
  4. )
  5. const (
  6. JsonAuthMethodNoAuth = "noauth"
  7. JsonAuthMethodUserPass = "password"
  8. )
  9. type SocksConfig struct {
  10. AuthMethod string `json:"auth"`
  11. Username string `json:"user"`
  12. Password string `json:"pass"`
  13. }
  14. func loadConfig(rawConfig []byte) (SocksConfig, error) {
  15. config := SocksConfig{}
  16. err := json.Unmarshal(rawConfig, &config)
  17. return config, err
  18. }