Documentation ¶
Index ¶
- Constants
- func DefaultFingerprinter(x PublicKey) p2p.PeerID
- type Addr
- type Fingerprinter
- type Option
- type PrivateKey
- type PublicKey
- type Swarm
- func (s *Swarm[T]) Ask(ctx context.Context, resp []byte, dst Addr[T], data p2p.IOVec) (int, error)
- func (s *Swarm[T]) Close() (retErr error)
- func (s *Swarm[T]) LocalAddrs() (ret []Addr[T])
- func (s *Swarm[T]) LocalID() p2p.PeerID
- func (s *Swarm[T]) LookupPublicKey(ctx context.Context, x Addr[T]) (PublicKey, error)
- func (s *Swarm[T]) MTU() int
- func (s *Swarm[T]) ParseAddr(data []byte) (Addr[T], error)
- func (s *Swarm[T]) PublicKey() PublicKey
- func (s *Swarm[T]) Receive(ctx context.Context, th func(p2p.Message[Addr[T]])) error
- func (s *Swarm[T]) ServeAsk(ctx context.Context, ...) error
- func (s *Swarm[T]) Tell(ctx context.Context, dst Addr[T], data p2p.IOVec) error
Constants ¶
View Source
const DefaultMTU = 1 << 20
Variables ¶
This section is empty.
Functions ¶
func DefaultFingerprinter ¶
func DefaultFingerprinter(x PublicKey) p2p.PeerID
Types ¶
type Fingerprinter ¶
type Fingerprinter = func(PublicKey) p2p.PeerID
type Option ¶
type Option[T p2p.Addr] func(s *Swarm[T])
func WithFingerprinter ¶
func WithFingerprinter[T p2p.Addr](fp Fingerprinter) Option[T]
func WithWhilelist ¶
type PrivateKey ¶
type PrivateKey = x509.PrivateKey
type Swarm ¶
type Swarm[T p2p.Addr] struct {
// contains filtered or unexported fields
}
func New ¶
func New[T p2p.Addr](x p2p.Swarm[T], privKey x509.PrivateKey, opts ...Option[T]) (*Swarm[T], error)
New creates a new swarm on top of x, using privKey for authentication
func (*Swarm[T]) LocalAddrs ¶
func (*Swarm[T]) LookupPublicKey ¶
Click to show internal directories.
Click to hide internal directories.