server_config.go 486 B

1234567891011121314151617181920212223242526272829
  1. package socks
  2. import (
  3. v2net "v2ray.com/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. Timeout uint32
  15. }
  16. func (this *Config) HasAccount(username, password string) bool {
  17. if this.Accounts == nil {
  18. return false
  19. }
  20. storedPassed, found := this.Accounts[username]
  21. if !found {
  22. return false
  23. }
  24. return storedPassed == password
  25. }