sshswarm

package
v0.0.0-...-d4b7e32 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MTU = 1 << 17

Variables

This section is empty.

Functions

func NewSignerFromSigner

func NewSignerFromSigner(x crypto.Signer) (ssh.Signer, error)

Types

type Addr

type Addr struct {
	Fingerprint string
	IP          netip.Addr
	Port        uint16
}

func NewAddr

func NewAddr(publicKey PublicKey, host string, port int) *Addr

func ParseAddr

func ParseAddr(data []byte) (Addr, error)

func (Addr) GetIP

func (a Addr) GetIP() netip.Addr

func (Addr) GetTCP

func (a Addr) GetTCP() net.TCPAddr

func (Addr) Key

func (a Addr) Key() string

func (Addr) MapIP

func (a Addr) MapIP(fn func(netip.Addr) netip.Addr) Addr

func (Addr) MapTCP

func (a Addr) MapTCP(fn func(net.TCPAddr) net.TCPAddr) p2p.Addr

func (Addr) MarshalText

func (a Addr) MarshalText() ([]byte, error)

func (Addr) String

func (a Addr) String() string

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() Addr

func (*Conn) Send

func (c *Conn) Send(wantReply bool, payload []byte) ([]byte, error)

type Option

type Option func(s *Swarm)

Option configures a swarm

type PrivateKey

type PrivateKey = ssh.Signer

type PublicKey

type PublicKey = ssh.PublicKey

type Swarm

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

func New

func New(laddr string, privateKey ssh.Signer, opts ...Option) (*Swarm, error)

func (*Swarm) Ask

func (s *Swarm) Ask(ctx context.Context, resp []byte, dst Addr, data p2p.IOVec) (int, error)

func (*Swarm) Close

func (s *Swarm) Close() error

func (*Swarm) LocalAddrs

func (s *Swarm) LocalAddrs() []Addr

func (*Swarm) LookupPublicKey

func (s *Swarm) LookupPublicKey(ctx context.Context, x Addr) (PublicKey, error)

func (*Swarm) MTU

func (s *Swarm) MTU() int

func (*Swarm) ParseAddr

func (s *Swarm) ParseAddr(data []byte) (Addr, error)

func (*Swarm) PublicKey

func (s *Swarm) PublicKey() PublicKey

func (*Swarm) Receive

func (s *Swarm) Receive(ctx context.Context, th func(p2p.Message[Addr])) error

func (*Swarm) ServeAsk

func (s *Swarm) ServeAsk(ctx context.Context, fn func(context.Context, []byte, p2p.Message[Addr]) int) error

func (*Swarm) Tell

func (s *Swarm) Tell(ctx context.Context, dst Addr, data p2p.IOVec) error

Jump to

Keyboard shortcuts

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