send

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:    "send",
	Usage:   "make the given file available to your peer",
	Aliases: []string{"s"},
	Action:  Action,
	Flags: []cli.Flag{
		&cli.IntFlag{
			Name:    "w",
			Aliases: []string{"word-count"},
			Usage:   "the number of random words to use (min 3)",
			EnvVars: []string{"PCP_WORD_COUNT"},
			Value:   4,
		},
	},
	ArgsUsage: `FILE`,
	Description: `
The send subcommand generates four random words based on the first
bytes of a newly generated peer identity. The first word and the
current time are used to generate an identifier that is broadcasted
in your local network via mDNS and provided through the distributed
hash table of the IPFS network.

After a peer attempts to connect it starts a password authen-
ticated key exchange (PAKE) with the remaining three words to
proof that the peer is in possession of the password. While this
is happening the tool still searches for other peers as the
currently connected one could fail the authentication procedure.

After the authentication was successful and the peer confirmed
the file transfer the transmission is started.
`,
}

Command holds the `send` subcommand configuration.

Functions

func Action

func Action(c *cli.Context) error

Action contains the logic for the send subcommand of the pcp program. It is mainly responsible for input parsing and service initialisation.

Types

type Advertiser

type Advertiser interface {
	Advertise(chanID int) error
	Shutdown()
}

type Node

type Node struct {
	*pcpnode.Node
	// contains filtered or unexported fields
}

Node encapsulates the logic of advertising and transmitting a particular file to a peer.

func InitNode

func InitNode(c *cli.Context, filepath string, words []string) (*Node, error)

InitNode returns a fully configured node ready to start advertising that we want to send a specific file.

func (*Node) HandleSuccessfulKeyExchange

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

func (*Node) Shutdown

func (n *Node) Shutdown()

func (*Node) StartAdvertising added in v0.3.0

func (n *Node) StartAdvertising(c *cli.Context)

StartAdvertising asynchronously advertises the given code through the means of all registered advertisers. Currently these are multicast DNS and DHT.

func (*Node) StopAdvertising

func (n *Node) StopAdvertising()

func (*Node) Transfer

func (n *Node) Transfer(peerID peer.ID) error

Jump to

Keyboard shortcuts

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