Documentation ¶
Index ¶
- func AddIgnoredLocalCIDRs(cidrs ...string)
- func GetIgnoredLocalCIDRs() []net.IPNet
- func GetIgnoredLocalInterfaceNamePrefixs() []string
- func IPIgnored(ip net.IP) bool
- func ListLocalIPs() ([]net.IP, error)
- func MustParseNonce(nonce string) byte
- func NewNonce() string
- func RemoveIgnoredLocalCIDRs(cidrs ...string)
- func SetIgnoredLocalCIDRs(cidrs ...string)
- func SetIgnoredLocalInterfaceNamePrefixs(prefixs ...string)
- func SetLocalIPs(ips ...net.IP)
- type ControlCode
- type Controller
- type ControllerManager
- type Datagram
- type Disco
- type Error
- type FileSecretStore
- type NATInfo
- type NATType
- type NetworkSecret
- type Peer
- type PeerID
- type PeerUDPAddr
- type Peermap
- type SecretStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddIgnoredLocalCIDRs ¶
func AddIgnoredLocalCIDRs(cidrs ...string)
func GetIgnoredLocalCIDRs ¶
func GetIgnoredLocalInterfaceNamePrefixs ¶
func GetIgnoredLocalInterfaceNamePrefixs() []string
func ListLocalIPs ¶
func MustParseNonce ¶
func RemoveIgnoredLocalCIDRs ¶
func RemoveIgnoredLocalCIDRs(cidrs ...string)
func SetIgnoredLocalCIDRs ¶
func SetIgnoredLocalCIDRs(cidrs ...string)
func SetIgnoredLocalInterfaceNamePrefixs ¶
func SetIgnoredLocalInterfaceNamePrefixs(prefixs ...string)
func SetLocalIPs ¶
Types ¶
type ControlCode ¶
type ControlCode uint8
const ( CONTROL_RELAY ControlCode = 0 CONTROL_NEW_PEER ControlCode = 1 CONTROL_NEW_PEER_UDP_ADDR ControlCode = 2 CONTROL_LEAD_DISCO ControlCode = 3 CONTROL_UPDATE_NETWORK_SECRET ControlCode = 20 CONTROL_UPDATE_NAT_INFO ControlCode = 21 CONTROL_UPDATE_META ControlCode = 22 CONTROL_CONN ControlCode = 30 )
func (ControlCode) Byte ¶
func (code ControlCode) Byte() byte
func (ControlCode) String ¶
func (code ControlCode) String() string
type Controller ¶
type ControllerManager ¶
type ControllerManager interface { Register(Controller) Unregister(Controller) }
type Datagram ¶
Datagram is the packet from peer or to peer
func (*Datagram) TryDecrypt ¶
TryDecrypt the datagram from peer
type FileSecretStore ¶
type FileSecretStore struct {
StoreFilePath string
}
func (*FileSecretStore) NetworkSecret ¶
func (s *FileSecretStore) NetworkSecret() (NetworkSecret, error)
func (*FileSecretStore) UpdateNetworkSecret ¶
func (s *FileSecretStore) UpdateNetworkSecret(secret NetworkSecret) error
type NetworkSecret ¶
type NetworkSecret struct { Secret string `json:"secret"` Network string `json:"network"` Expire time.Time `json:"expire"` }
func (NetworkSecret) Expired ¶
func (s NetworkSecret) Expired() bool
func (*NetworkSecret) NetworkSecret ¶
func (s *NetworkSecret) NetworkSecret() (NetworkSecret, error)
func (*NetworkSecret) UpdateNetworkSecret ¶
func (s *NetworkSecret) UpdateNetworkSecret(secret NetworkSecret) error
type PeerUDPAddr ¶
PeerUDPAddr describe the peer udp addr
type Peermap ¶
type Peermap struct {
// contains filtered or unexported fields
}
func NewPeermap ¶
func NewPeermap(server *url.URL, store SecretStore) (*Peermap, error)
func NewPeermapURL ¶
func NewPeermapURL(serverURL string, store SecretStore) (*Peermap, error)
func (*Peermap) SecretStore ¶
func (s *Peermap) SecretStore() SecretStore
type SecretStore ¶
type SecretStore interface { NetworkSecret() (NetworkSecret, error) UpdateNetworkSecret(NetworkSecret) error }
Click to show internal directories.
Click to hide internal directories.