disco

package
v0.7.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIgnoredLocalCIDRs added in v0.0.2

func AddIgnoredLocalCIDRs(cidrs ...string)

func GetIgnoredLocalCIDRs added in v0.6.2

func GetIgnoredLocalCIDRs() []net.IPNet

func GetIgnoredLocalInterfaceNamePrefixs added in v0.6.2

func GetIgnoredLocalInterfaceNamePrefixs() []string

func IPIgnored added in v0.6.2

func IPIgnored(ip net.IP) bool

func ListLocalIPs

func ListLocalIPs() ([]net.IP, error)

func MustParseNonce added in v0.7.3

func MustParseNonce(nonce string) byte

func NewNonce added in v0.7.3

func NewNonce() string

func RemoveIgnoredLocalCIDRs added in v0.6.1

func RemoveIgnoredLocalCIDRs(cidrs ...string)

func SetIgnoredLocalCIDRs

func SetIgnoredLocalCIDRs(cidrs ...string)

func SetIgnoredLocalInterfaceNamePrefixs

func SetIgnoredLocalInterfaceNamePrefixs(prefixs ...string)

func SetLocalIPs added in v0.0.2

func SetLocalIPs(ips ...net.IP)

Types

type ControlCode added in v0.7.3

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_CONN                  ControlCode = 30
)

func (ControlCode) Byte added in v0.7.3

func (code ControlCode) Byte() byte

func (ControlCode) String added in v0.7.3

func (code ControlCode) String() string

type Controller added in v0.6.1

type Controller interface {
	Handle(b []byte)
	Name() string
	Type() uint8
}

type ControllerManager added in v0.6.1

type ControllerManager interface {
	Register(Controller)
	Unregister(Controller)
}

type Datagram

type Datagram struct {
	PeerID PeerID
	Data   []byte
}

Datagram is the packet from peer or to peer

func (*Datagram) TryDecrypt

func (d *Datagram) TryDecrypt(symmAlgo secure.SymmAlgo) []byte

TryDecrypt the datagram from peer

func (*Datagram) TryEncrypt

func (d *Datagram) TryEncrypt(symmAlgo secure.SymmAlgo) []byte

TryEncrypt the datagram to peer

type Disco added in v0.2.3

type Disco struct {
	Magic func() []byte
}

func (*Disco) NewPing added in v0.2.3

func (d *Disco) NewPing(peerID PeerID) []byte

func (*Disco) ParsePing added in v0.2.3

func (d *Disco) ParsePing(b []byte) PeerID

type Error added in v0.7.3

type Error struct {
	Code int
	Msg  string
}

func (Error) Error added in v0.7.3

func (e Error) Error() string

func (Error) MarshalTo added in v0.7.3

func (e Error) MarshalTo(w io.Writer)

func (Error) Wrap added in v0.7.3

func (e Error) Wrap(err error) Error

type FileSecretStore added in v0.7.3

type FileSecretStore struct {
	StoreFilePath string
}

func (*FileSecretStore) NetworkSecret added in v0.7.3

func (s *FileSecretStore) NetworkSecret() (NetworkSecret, error)

func (*FileSecretStore) UpdateNetworkSecret added in v0.7.3

func (s *FileSecretStore) UpdateNetworkSecret(secret NetworkSecret) error

type NATInfo added in v0.7.9

type NATInfo struct {
	Type  NATType
	Addrs []*net.UDPAddr
}

type NATType added in v0.7.0

type NATType string
const (
	Unknown  NATType = ""
	Hard     NATType = "hard"
	Easy     NATType = "easy"
	UPnP     NATType = "upnp"
	IP4      NATType = "ip4"
	IP6      NATType = "ip6"
	Internal NATType = "internal"
)

func (NATType) AccurateThan added in v0.7.2

func (t NATType) AccurateThan(t1 NATType) bool

func (NATType) String added in v0.7.0

func (t NATType) String() string

type NetworkSecret added in v0.7.3

type NetworkSecret struct {
	Secret  string    `json:"secret"`
	Network string    `json:"network"`
	Expire  time.Time `json:"expire"`
}

func (NetworkSecret) Expired added in v0.7.3

func (s NetworkSecret) Expired() bool

func (*NetworkSecret) NetworkSecret added in v0.7.3

func (s *NetworkSecret) NetworkSecret() (NetworkSecret, error)

func (*NetworkSecret) UpdateNetworkSecret added in v0.7.3

func (s *NetworkSecret) UpdateNetworkSecret(secret NetworkSecret) error

type Peer added in v0.6.4

type Peer struct {
	ID       PeerID
	Metadata url.Values
}

Peer descibe the peer info

type PeerID added in v0.7.3

type PeerID string

func (PeerID) Bytes added in v0.7.3

func (id PeerID) Bytes() []byte

func (PeerID) Len added in v0.7.3

func (id PeerID) Len() byte

func (PeerID) Network added in v0.7.3

func (id PeerID) Network() string

func (PeerID) String added in v0.7.3

func (id PeerID) String() string

type PeerUDPAddr added in v0.6.4

type PeerUDPAddr struct {
	ID   PeerID
	Addr *net.UDPAddr
	Type NATType
}

PeerUDPAddr describe the peer udp addr

type Peermap added in v0.7.3

type Peermap struct {
	// contains filtered or unexported fields
}

func NewPeermap added in v0.7.3

func NewPeermap(server *url.URL, store SecretStore) (*Peermap, error)

func NewPeermapURL added in v0.7.3

func NewPeermapURL(serverURL string, store SecretStore) (*Peermap, error)

func (*Peermap) SecretStore added in v0.7.3

func (s *Peermap) SecretStore() SecretStore

func (*Peermap) String added in v0.7.3

func (s *Peermap) String() string

type SecretStore added in v0.7.3

type SecretStore interface {
	NetworkSecret() (NetworkSecret, error)
	UpdateNetworkSecret(NetworkSecret) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL