p2p

package
v0.0.0-...-07c2c16 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: LGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyPairEmpty    = errors.New("p2p key pair is empty")
	ErrKeyPairGenerate = errors.New("can't generate p2p key pair")
	ErrInvalidIP       = errors.New("invalid IP")
)

Functions

This section is empty.

Types

type KeyPair

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

func (*KeyPair) Generate

func (kp *KeyPair) Generate() (*KeyPair, error)

func (*KeyPair) LoadFromFile

func (kp *KeyPair) LoadFromFile(dataDir string) (KeyPair, error)

func (*KeyPair) PrivKey

func (kp *KeyPair) PrivKey() *p2pcrypto.PrivKey

func (*KeyPair) PrivKeyString

func (kp *KeyPair) PrivKeyString() string

func (*KeyPair) PubKey

func (kp *KeyPair) PubKey() *p2pcrypto.PubKey

func (*KeyPair) PubKeyString

func (kp *KeyPair) PubKeyString() string

func (*KeyPair) SaveToFile

func (kp *KeyPair) SaveToFile(dataDir string) error

type KeyPairFile

type KeyPairFile struct {
	PrivateKey []byte `json:"privateKey"`
	PublicKey  []byte `json:"publicKey"`
}

type P2P

type P2P struct {
	Host    string `yaml:"host"`
	Port    string `yaml:"port"`
	P2PHost host.Host
	// contains filtered or unexported fields
}

func Create

func Create(dataDir string, config *P2P, protocolID protocol.ID) P2P

func (*P2P) ConnectToPeer

func (p *P2P) ConnectToPeer(target string) (*bufio.ReadWriter, error)

func (*P2P) GenerateKeyPair

func (p *P2P) GenerateKeyPair() error

func (*P2P) KeyPair

func (p *P2P) KeyPair() *KeyPair

func (*P2P) LoadKeyPairFromFile

func (p *P2P) LoadKeyPairFromFile() error

func (*P2P) SaveKeyPairToFile

func (p *P2P) SaveKeyPairToFile() error

func (*P2P) SetKeyPair

func (p *P2P) SetKeyPair(keyPair *KeyPair) error

func (*P2P) StartHost

func (p *P2P) StartHost() error

type P2PRPC

type P2PRPC struct {
	Host    string
	P2PHost host.Host
	// contains filtered or unexported fields
}

func CreateP2PRPC

func CreateP2PRPC(dataDir string, hostIP string, port string, protocolID protocol.ID) P2PRPC

func (*P2PRPC) Start

func (p *P2PRPC) Start()

func (*P2PRPC) StartClient

func (p *P2PRPC) StartClient(target string)

type PingArgs

type PingArgs struct {
	Data []byte
}

type PingReply

type PingReply struct {
	Data []byte
}

type Stats

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

type Type3Service

type Type3Service struct{}

func (*Type3Service) Ping

func (t *Type3Service) Ping(ctx context.Context, argType PingArgs, replyType *PingReply) error

, argType PingArgs, replyType *PingReply

Jump to

Keyboard shortcuts

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