Documentation ¶
Index ¶
- Constants
- func DefaultFingerprinter(pub *x509.PublicKey) (ret p2p.PeerID)
- type Addr
- type Fingerprinter
- type Option
- type Swarm
- func (s *Swarm[T]) Close() error
- func (s *Swarm[T]) LocalAddrs() []Addr[T]
- func (s *Swarm[T]) LookupPublicKey(ctx context.Context, dst Addr[T]) (ret x509.PublicKey, _ error)
- func (s *Swarm[T]) MTU() int
- func (s *Swarm[T]) ParseAddr(data []byte) (Addr[T], error)
- func (s *Swarm[T]) PublicKey() x509.PublicKey
- func (s *Swarm[T]) Receive(ctx context.Context, th func(p2p.Message[Addr[T]])) error
- func (s *Swarm[T]) Tell(ctx context.Context, dst Addr[T], v p2p.IOVec) error
Constants ¶
View Source
const Overhead = p2pke.Overhead
Variables ¶
This section is empty.
Functions ¶
func DefaultFingerprinter ¶
DefaultFingerprinter returns a fingerprint for pub using SHAKE256
Types ¶
type Fingerprinter ¶
type Option ¶
type Option[T p2p.Addr] func(*swarmConfig[T])
func WithBackground ¶
WithBackground sets the background context used by the swarm
func WithFingerprinter ¶
func WithFingerprinter[T p2p.Addr](fp Fingerprinter) Option[T]
WithFingerprinter sets the fingerprinter used by the swarm. The default is p2p.DefaultFingerprinter
func WithWhitelist ¶
WithWhitelist sets the whitelist for incoming messages. If !fn(msg.Src) then the message is dropped.
type Swarm ¶
type Swarm[T p2p.Addr] struct {
// contains filtered or unexported fields
}
func New ¶
func New[T p2p.Addr](inner p2p.Swarm[T], privateKey x509.PrivateKey, opts ...Option[T]) *Swarm[T]
func (*Swarm[T]) LocalAddrs ¶
LocalAddrs implements p2p.Swarm.LocalAddrs
func (*Swarm[T]) LookupPublicKey ¶
LookupPublicKey implements p2p.SecureSwarm.PublicKey
Click to show internal directories.
Click to hide internal directories.