multiplex

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBrokenSession = errors.New("broken session")
View Source
var ErrBrokenStream = errors.New("broken stream")
View Source
var ErrNoRxCredit error = errors.New("No Rx credit is left")
View Source
var ErrNoTxCredit error = errors.New("No Tx credit is left")

Functions

This section is empty.

Types

type Deobfser

type Deobfser func([]byte) (*Frame, error)

func MakeDeobfs

func MakeDeobfs(key []byte) Deobfser

type Frame

type Frame struct {
	StreamID uint32
	Seq      uint32
	Closing  uint8
	Payload  []byte
}

type Obfser

type Obfser func(*Frame) ([]byte, error)

func MakeObfs

func MakeObfs(key []byte) Obfser

type Session

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

func MakeSession

func MakeSession(id uint32, valve *Valve, obfs Obfser, deobfs Deobfser, obfsedRead func(net.Conn, []byte) (int, error)) *Session

func (*Session) AcceptStream

func (sesh *Session) AcceptStream() (*Stream, error)

func (*Session) AddConnection

func (sesh *Session) AddConnection(conn net.Conn)

func (*Session) Close

func (sesh *Session) Close() error

func (*Session) IsBroken

func (sesh *Session) IsBroken() bool

func (*Session) OpenStream

func (sesh *Session) OpenStream() (*Stream, error)

type Stream

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

func (*Stream) Close

func (stream *Stream) Close() error

active close. Close locally and tell the remote that this stream is being closed

func (*Stream) Read

func (stream *Stream) Read(buf []byte) (n int, err error)

func (*Stream) Write

func (stream *Stream) Write(in []byte) (n int, err error)

type Valve

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

Valve needs to be universal, across all sessions that belong to a user gabe please don't sue

func MakeValve

func MakeValve(rxRate, txRate int64, rxCredit, txCredit *int64) *Valve

func (*Valve) AddRxCredit

func (v *Valve) AddRxCredit(n int64) int64

n can be negative

func (*Valve) AddTxCredit

func (v *Valve) AddTxCredit(n int64) int64

n can be negative

func (*Valve) GetRxCredit

func (v *Valve) GetRxCredit() int64

func (*Valve) GetTxCredit

func (v *Valve) GetTxCredit() int64

func (*Valve) SetRxCredit

func (v *Valve) SetRxCredit(n int64)

func (*Valve) SetRxRate

func (v *Valve) SetRxRate(rate int64)

func (*Valve) SetTxCredit

func (v *Valve) SetTxCredit(n int64)

func (*Valve) SetTxRate

func (v *Valve) SetTxRate(rate int64)

Jump to

Keyboard shortcuts

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