server_config.go 442 B

1234567891011121314151617181920212223
  1. package socks
  2. import (
  3. v2net "v2ray.com/core/common/net"
  4. )
  5. func (this *ServerConfig) HasAccount(username, password string) bool {
  6. if this.Accounts == nil {
  7. return false
  8. }
  9. storedPassed, found := this.Accounts[username]
  10. if !found {
  11. return false
  12. }
  13. return storedPassed == password
  14. }
  15. func (this *ServerConfig) GetNetAddress() v2net.Address {
  16. if this.Address == nil {
  17. return v2net.LocalHostIP
  18. }
  19. return this.Address.AsAddress()
  20. }