handshake

package
v0.0.0-...-c3fa490 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handshake

type Handshake struct {
	Pstr     string
	InfoHash [20]byte
	PeerID   [20]byte
}

A Handshake is a special message that a peer uses to identify itself

func New

func New(infoHash, peerID [20]byte) *Handshake

New creates a new handshake with the standard pstr

func Read

func Read(r io.Reader) (*Handshake, error)

Read parses a handshake from a stream

func (*Handshake) Serialize

func (h *Handshake) Serialize() []byte

Serialize serializes the handshake to a buffer

Jump to

Keyboard shortcuts

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