entity

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const PeerKeyLength = 32

Variables

View Source
var (
	ErrDeviceNotFound = errors.New("device not found")
)
View Source
var (
	ErrPeerNotFound = errors.New("peer not found")
)

Functions

This section is empty.

Types

type Device

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

func NewDevice

func NewDevice(name DeviceId, listenPort int, privateKey []byte) *Device

func (*Device) ListenPort

func (d *Device) ListenPort() int

func (*Device) Name

func (d *Device) Name() DeviceId

func (*Device) PrivateKey

func (d *Device) PrivateKey() [32]byte

type DeviceId

type DeviceId string

type FilterPeerService

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

func NewFilterPeerService

func NewFilterPeerService(searcher PeerSearcher, allower PeerAllower) *FilterPeerService

func (*FilterPeerService) Execute

func (svc *FilterPeerService) Execute(ctx context.Context, deviceName DeviceId, publicKey []byte) ([]*Peer, error)

type Peer

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

func NewPeer

func NewPeer(id PeerId, deviceName string, publicKey [32]byte) *Peer

func (*Peer) DeviceName

func (p *Peer) DeviceName() string

func (*Peer) Id

func (p *Peer) Id() PeerId

func (*Peer) LocalId

func (p *Peer) LocalId() string

func (*Peer) PublicKey

func (p *Peer) PublicKey() [32]byte

func (*Peer) RemoteId

func (p *Peer) RemoteId() string

type PeerAllower

type PeerAllower interface {
	Allow(ctx context.Context, deviceName string, publicKey []byte, peerId PeerId) bool
}

type PeerId

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

func NewPeerId

func NewPeerId(devicePublicKey, peerPublicKey []byte) PeerId

func (*PeerId) EndpointKey

func (p *PeerId) EndpointKey() string

func (*PeerId) RemoteEndpointKey

func (p *PeerId) RemoteEndpointKey() string

func (PeerId) String

func (p PeerId) String() string

type PeerKey

type PeerKey [PeerKeyLength]byte

type PeerSearcher

type PeerSearcher interface {
	SearchByDevice(context.Context, DeviceId) ([]*Peer, error)
}

Directories

Path Synopsis
Package mock_entity is a generated GoMock package.
Package mock_entity is a generated GoMock package.

Jump to

Keyboard shortcuts

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