file_transfer

package module
v0.0.0-...-07e85e7 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 22 Imported by: 0

README

Simple file transfer app built with go-libp2p APIs

Documentation

Index

Constants

View Source
const (
	ListProtocol = "/halimao/file/list"
	GetProtocol  = "/halimao/file/fetch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

type Node

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

func NewNode

func NewNode(dirPath string, opts ...Option) (*Node, error)

func (*Node) Addrs

func (n *Node) Addrs() []ma.Multiaddr

func (*Node) Close

func (n *Node) Close()

func (*Node) FileNames

func (n *Node) FileNames() ([]string, error)

func (*Node) GetFile

func (n *Node) GetFile(ai peer.AddrInfo, file string) []byte

func (*Node) GetFileList

func (n *Node) GetFileList(ai peer.AddrInfo) []string

func (*Node) ID

func (n *Node) ID() peer.ID

func (*Node) NumPeers

func (n *Node) NumPeers() int

type Option

type Option func(c *Config) error

func WithPort

func WithPort(p string) Option

func WithPrivKey

func WithPrivKey(pk crypto.PrivateKey) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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