types.go 826 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Package pia is a standalone PIA WireGuard control-plane client.
  2. package pia
  3. import (
  4. "context"
  5. "net/netip"
  6. "time"
  7. )
  8. type Region struct {
  9. ID string
  10. Name string
  11. CountryCode string
  12. Geo bool
  13. PortForwarding bool
  14. WireGuard []WireGuardServer
  15. }
  16. type WireGuardServer struct {
  17. Hostname string
  18. IP netip.Addr
  19. }
  20. type Token struct {
  21. Value []byte
  22. ExpiresAt time.Time
  23. }
  24. type Registration struct {
  25. PeerIP netip.Prefix
  26. ServerKey string
  27. ServerIP netip.Addr
  28. ServerPort uint16
  29. DNSServers []netip.Addr
  30. }
  31. type Authenticator interface {
  32. Authenticate(ctx context.Context, username string, password []byte) (Token, error)
  33. }
  34. type Registrar interface {
  35. RegisterKey(ctx context.Context, server WireGuardServer, token string, publicKey string) (Registration, error)
  36. }