tunnel

package
v0.0.0-...-159cab8 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2015 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

date : 2015-08-31 author: xjdrew

Index

Constants

View Source
const (
	TaaTokenSize     int = aes.BlockSize
	TaaSignatureSize int = md5.Size
	TaaBlockSize     int = TaaTokenSize + TaaSignatureSize
)
View Source
const (
	LINK_DATA uint8 = iota
	LINK_CREATE
	LINK_CLOSE
	LINK_CLOSE_RECV
	LINK_CLOSE_SEND
)
View Source
const (
	PacketSize = 8192
)

tunnel read/write timeout

Variables

View Source
var (
	Timeout  int64 = 0
	LogLevel uint  = 1
)

Functions

func Debug

func Debug(format string, a ...interface{})

func Error

func Error(format string, a ...interface{})

func Info

func Info(format string, a ...interface{})

func Log

func Log(format string, a ...interface{})

func LogCurStack

func LogCurStack(format string, a ...interface{})

func LogStack

func LogStack(format string, a ...interface{})

func Panic

func Panic(format string, a ...interface{})

func Recover

func Recover()

func Trace

func Trace(format string, a ...interface{})

Types

type Client

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

func NewClient

func NewClient(listen, backend, secret string, tunnels uint) (*Client, error)

func (*Client) Start

func (cli *Client) Start() error

func (*Client) Status

func (cli *Client) Status()

type Cmd

type Cmd struct {
	Cmd    uint8
	Linkid uint16
}

type Conn

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

func (*Conn) Flush

func (conn *Conn) Flush() error

func (*Conn) Read

func (conn *Conn) Read(b []byte) (int, error)

func (*Conn) SetCipherKey

func (conn *Conn) SetCipherKey(key []byte)

func (*Conn) Write

func (conn *Conn) Write(b []byte) (int, error)

type Hub

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

func (*Hub) Send

func (hub *Hub) Send(cmd uint8, linkid uint16, data []byte) bool

func (*Hub) Start

func (hub *Hub) Start()

func (*Hub) Status

func (hub *Hub) Status()

type HubItem

type HubItem struct {
	*Hub
	// contains filtered or unexported fields
}

func (*HubItem) Status

func (h *HubItem) Status()

type HubQueue

type HubQueue []*HubItem

func (HubQueue) Len

func (cq HubQueue) Len() int

func (HubQueue) Less

func (cq HubQueue) Less(i, j int) bool

func (*HubQueue) Pop

func (cq *HubQueue) Pop() interface{}

func (*HubQueue) Push

func (cq *HubQueue) Push(x interface{})

func (HubQueue) Swap

func (cq HubQueue) Swap(i, j int)

type IdAllocator

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

func (*IdAllocator) Acquire

func (alloc *IdAllocator) Acquire() uint16

func (*IdAllocator) Release

func (alloc *IdAllocator) Release(id uint16)
type Link struct {
	// contains filtered or unexported fields
}

func (*Link) Pump

func (link *Link) Pump(conn *net.TCPConn)

func (*Link) SendClose

func (link *Link) SendClose()

func (*Link) SendCreate

func (link *Link) SendCreate()

type LinkBuffer

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

func NewLinkBuffer

func NewLinkBuffer(sz int) *LinkBuffer

func (*LinkBuffer) Close

func (b *LinkBuffer) Close() bool

func (*LinkBuffer) Len

func (b *LinkBuffer) Len() int

func (*LinkBuffer) Pop

func (b *LinkBuffer) Pop() ([]byte, bool)

func (*LinkBuffer) Put

func (b *LinkBuffer) Put(data []byte) bool

type MPool

type MPool struct {
	*sync.Pool
	// contains filtered or unexported fields
}

func NewMPool

func NewMPool(sz int) *MPool

func (*MPool) Get

func (p *MPool) Get() []byte

func (*MPool) Put

func (p *MPool) Put(x []byte)

type Server

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

func NewServer

func NewServer(listen, backend, secret string) (*Server, error)

func (*Server) Start

func (server *Server) Start() error

func (*Server) Status

func (server *Server) Status()

type ServerHub

type ServerHub struct {
	*Hub
	// contains filtered or unexported fields
}

type Service

type Service interface {
	Start() error
	Status()
}

type Taa

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

gotunnel auth algorithm

func NewTaa

func NewTaa(key string) *Taa

func (*Taa) CheckSignature

func (a *Taa) CheckSignature(src []byte) bool

func (*Taa) ExchangeCipherBlock

func (a *Taa) ExchangeCipherBlock(src []byte) ([]byte, bool)

exchange cipher block

func (*Taa) GenCipherBlock

func (a *Taa) GenCipherBlock(token *authToken) []byte

generate cipher block

func (*Taa) GenToken

func (a *Taa) GenToken()

generate new token

func (*Taa) GetRc4key

func (a *Taa) GetRc4key() []byte

func (*Taa) VerifyCipherBlock

func (a *Taa) VerifyCipherBlock(src []byte) bool

verify cipher block

type Tunnel

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

func (*Tunnel) Read

func (tun *Tunnel) Read() (linkid uint16, data []byte, err error)

can't read concurrently

func (Tunnel) String

func (tun Tunnel) String() string

func (*Tunnel) Write

func (tun *Tunnel) Write(linkid uint16, data []byte) (err error)

can write concurrently

Jump to

Keyboard shortcuts

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