stream

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TmpArcName = "acp-tmp.tar.gz"

Variables

View Source
var ErrNotAvailable = errors.New("this dialer is not available")

Functions

func SetLogger

func SetLogger(l pnet.Logger)

Types

type Dialer

type Dialer interface {
	// Initialize Dialer from config and environment, while checking availability.
	// Return ErrNotAvailable if Dialer is not supported
	Init(conf config.Config) error
	// Populate the info struct to be sent to rendezvous service for information exchange
	SetInfo(info *pnet.SelfInfo)
	// Base on the info received, establish a stream as the sender
	IntoSender(ctx context.Context, info pnet.PeerInfo) (io.WriteCloser, error)
	// Base on the info received, establish a stream as the receiver
	IntoReceiver(ctx context.Context, info pnet.PeerInfo) (io.ReadCloser, error)
}

A Dialer establishes a stream for sending / receiving files, with the help of a rendezvous service.

After implementing a new Dialer: 1. Register

func init() {
	registerDialer("dialer_name", &DialerImpl{})
}

2. Specify information exchange in pnet.SelfInfo and pnet.PeerInfo 3. (optional) Provide configurable options in config.Config

func GetDialer

func GetDialer(name string) (Dialer, error)

type TSCapability

type TSCapability uint
const (
	TSTaildrop TSCapability = 1 << iota
	TSTun
)

type Tailscale

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

func (*Tailscale) Init

func (d *Tailscale) Init(conf config.Config) error

func (*Tailscale) IntoReceiver

func (d *Tailscale) IntoReceiver(ctx context.Context, info pnet.PeerInfo) (io.ReadCloser, error)

func (*Tailscale) IntoSender

func (d *Tailscale) IntoSender(ctx context.Context, info pnet.PeerInfo) (io.WriteCloser, error)

func (*Tailscale) SetInfo

func (d *Tailscale) SetInfo(info *pnet.SelfInfo)

type TcpHolePunch

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

func (*TcpHolePunch) Init

func (d *TcpHolePunch) Init(conf config.Config) (err error)

func (*TcpHolePunch) IntoReceiver

func (d *TcpHolePunch) IntoReceiver(ctx context.Context, info pnet.PeerInfo) (io.ReadCloser, error)

func (*TcpHolePunch) IntoSender

func (d *TcpHolePunch) IntoSender(ctx context.Context, info pnet.PeerInfo) (io.WriteCloser, error)

func (*TcpHolePunch) SetInfo

func (d *TcpHolePunch) SetInfo(info *pnet.SelfInfo)

Jump to

Keyboard shortcuts

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