client

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPeerOffline = errors.New("peer is offline")
	ErrPeerPassive = errors.New("peer is passive")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	PID        adc.PID
	Name       string
	Extensions adcp.ExtFeatures
}

type Conn

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

Conn represents a Client-to-Hub connection.

func DialHub

func DialHub(addr string, info *Config) (*Conn, error)

DialHub connects to a hub and runs a handshake.

func HubHandshake

func HubHandshake(conn *adc.Conn, conf *Config) (*Conn, error)

HubHandshake begins a Client-Hub handshake on a connection.

func (*Conn) CID

func (c *Conn) CID() adc.CID

CID returns Client ID associated with this connection.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Features

func (c *Conn) Features() adcp.ModFeatures

Features returns a set of negotiated features.

func (*Conn) Hub

func (c *Conn) Hub() adcp.HubInfo

Hub returns hub information.

func (*Conn) OnlinePeers

func (c *Conn) OnlinePeers() []*Peer

func (*Conn) PID

func (c *Conn) PID() adc.PID

PID returns Private ID associated with this connection.

func (*Conn) SID

func (c *Conn) SID() adc.SID

SID returns Session ID associated with this connection. Only valid after a Client-Hub handshake.

type File

type File interface {
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Closer
	Size() int64
	TTH() *adc.TTH
}

type FileInfo

type FileInfo struct {
	Size int64
	TTH  *adc.TTH
}

type Peer

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

func (*Peer) CanDial

func (p *Peer) CanDial() bool

func (*Peer) Dial

func (p *Peer) Dial(ctx context.Context) (*PeerConn, error)

Dial tries to dial the peer either in passive or active mode.

func (*Peer) Info

func (p *Peer) Info() adcp.UserInfo

func (*Peer) Online

func (p *Peer) Online() bool

type PeerConn

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

func (*PeerConn) Close

func (c *PeerConn) Close() error

func (*PeerConn) GetFile

func (c *PeerConn) GetFile(ctx context.Context, path string) (File, error)

func (*PeerConn) GetFileListBZIP

func (c *PeerConn) GetFileListBZIP(ctx context.Context) (io.ReadCloser, error)

func (*PeerConn) Peer

func (c *PeerConn) Peer() *Peer

func (*PeerConn) StatFile

func (c *PeerConn) StatFile(ctx context.Context, path string) (FileInfo, error)

func (*PeerConn) StatFileList

func (c *PeerConn) StatFileList(ctx context.Context, path string) (FileInfo, error)

Jump to

Keyboard shortcuts

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