config.go 480 B

12345678910111213141516171819202122232425262728
  1. package socks
  2. import (
  3. v2net "github.com/v2ray/v2ray-core/common/net"
  4. )
  5. const (
  6. AuthTypeNoAuth = byte(0)
  7. AuthTypePassword = byte(1)
  8. )
  9. type Config struct {
  10. AuthType byte
  11. Accounts map[string]string
  12. Address v2net.Address
  13. UDPEnabled bool
  14. }
  15. func (this *Config) HasAccount(username, password string) bool {
  16. if this.Accounts == nil {
  17. return false
  18. }
  19. storedPassed, found := this.Accounts[username]
  20. if !found {
  21. return false
  22. }
  23. return storedPassed == password
  24. }