You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServerObject.cs 914 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections.Generic;
  2. using System.Net;
  3. namespace Shadowsocks.Interop.V2Ray.Protocols.Socks
  4. {
  5. public class ServerObject
  6. {
  7. public string Address { get; set; }
  8. public int Port { get; set; }
  9. public List<UserObject> Users { get; set; }
  10. public ServerObject()
  11. {
  12. Address = "";
  13. Port = 0;
  14. Users = new();
  15. }
  16. public ServerObject(DnsEndPoint socksEndPoint, string username = "", string password = "")
  17. {
  18. Address = socksEndPoint.Host;
  19. Port = socksEndPoint.Port;
  20. Users = new();
  21. var hasCredential = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password);
  22. if (hasCredential)
  23. Users.Add(new()
  24. {
  25. User = username,
  26. Pass = password,
  27. });
  28. }
  29. }
  30. }