wireguard.go 1.4 KB

123456789101112131415161718192021222324252627282930
  1. package option
  2. import (
  3. "net/netip"
  4. "github.com/sagernet/sing/common/json/badoption"
  5. )
  6. type WireGuardEndpointOptions struct {
  7. System bool `json:"system,omitempty"`
  8. Name string `json:"name,omitempty"`
  9. MTU uint32 `json:"mtu,omitempty"`
  10. Address badoption.Listable[netip.Prefix] `json:"address"`
  11. PrivateKey string `json:"private_key"`
  12. ListenPort uint16 `json:"listen_port,omitempty"`
  13. Peers []WireGuardPeer `json:"peers,omitempty"`
  14. UDPTimeout badoption.Duration `json:"udp_timeout,omitempty"`
  15. Workers int `json:"workers,omitempty"`
  16. DialerOptions
  17. }
  18. type WireGuardPeer struct {
  19. Address string `json:"address,omitempty"`
  20. Port uint16 `json:"port,omitempty"`
  21. PublicKey string `json:"public_key,omitempty"`
  22. PreSharedKey string `json:"pre_shared_key,omitempty"`
  23. AllowedIPs badoption.Listable[netip.Prefix] `json:"allowed_ips,omitempty"`
  24. PersistentKeepaliveInterval uint16 `json:"persistent_keepalive_interval,omitempty"`
  25. Reserved []uint8 `json:"reserved,omitempty"`
  26. }