channel

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueueSize = 16
)

Variables

This section is empty.

Functions

func GetConnData

func GetConnData(conn net.Conn, bufferSize int, delay time.Duration) ([]byte, error)

Types

type CBPacket

type CBPacket struct {
	Target  PeerType
	Type    CBPacketType
	Payload string
	Seq     int
	Ack     int
}

type CBPacketType

type CBPacketType int
const (
	PacketTypeData CBPacketType = iota
	PacketTypeControl
)

type Channel

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

func NewChannel

func NewChannel(typ PeerType, options ChannelOptions) (*Channel, error)

func (*Channel) CloseChannel

func (c *Channel) CloseChannel()

func (*Channel) Receive

func (c *Channel) Receive() []byte

func (*Channel) Send

func (c *Channel) Send(data []byte)

type ChannelOptions

type ChannelOptions struct {
	ControlPacketCallback ControlPacketCallback
	Interval              time.Duration
	Password              string
	Transport             string
	Blocksize             int
	ErrorLogger           *log.Logger
	DebugLogger           *log.Logger
	TraceLogger           *log.Logger
}

type ControlPacketCallback

type ControlPacketCallback func(cmd, arg string)

type PeerType

type PeerType int
const (
	CLIENT PeerType = iota
	SERVER
)

type PortForwarding

type PortForwarding struct {
	Port     string
	Host     string
	HostPort string
}

func ParsePortForwarding

func ParsePortForwarding(param string) (*PortForwarding, error)

type Tunnel

type Tunnel struct {
	Channel
	// contains filtered or unexported fields
}

func NewTunnel

func NewTunnel(typ PeerType, options ChannelOptions) (*Tunnel, error)

func (*Tunnel) AddLocalPortForwarding

func (c *Tunnel) AddLocalPortForwarding(fwd PortForwarding)

func (*Tunnel) AddRemotePortForwarding

func (c *Tunnel) AddRemotePortForwarding(fwd PortForwarding)

func (*Tunnel) ExecuteCommand

func (t *Tunnel) ExecuteCommand(cmd string) (output string, err error)

func (*Tunnel) StartClient

func (t *Tunnel) StartClient()

func (*Tunnel) StartServer

func (t *Tunnel) StartServer()

func (*Tunnel) StartSftp

func (t *Tunnel) StartSftp() *sftp.Client

func (*Tunnel) StartSocksOnPort

func (t *Tunnel) StartSocksOnPort(port int)

Jump to

Keyboard shortcuts

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