common

package
v0.0.0-...-d9ac036 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K = float64(1024)
	M = 1024 * K
	G = 1024 * M
)

Variables

This section is empty.

Functions

func AddHostMapping

func AddHostMapping(host, target string)

func AddLocalOnly

func AddLocalOnly(expr string) (err error)

func CopyN

func CopyN(dst io.Writer, src io.Reader, size int) (n int, err error)

func DelHostMapping

func DelHostMapping(host string)

func DelLocalOnly

func DelLocalOnly(expr *regexp.Regexp)

func DialServer

func DialServer(conf *Config) (ses net.Conn, err error)

func FormatNS

func FormatNS(raw float64) string

func GetMappedHost

func GetMappedHost(host string) string

func IsLocalOnly

func IsLocalOnly(host string) bool

func ListHostMapping

func ListHostMapping() (mapping map[string]string)

func ListLocalOnly

func ListLocalOnly() (list []*regexp.Regexp)

func LoadLol

func LoadLol(conf *Config) error

func ParseLolFile

func ParseLolFile(lolFile string)

func PrintAcs

func PrintAcs()

func ReadByte

func ReadByte(r io.Reader) (rel byte, err error)

func ReadFull

func ReadFull(r io.Reader, buf []byte) error

func Transfer

func Transfer(destination io.WriteCloser, source io.ReadCloser, flow string)

Types

type ACStream

type ACStream struct {
	Index int
	// contains filtered or unexported fields
}

func DialRemote

func DialRemote(conf *Config, laddr *net.TCPAddr, target string) (conn *ACStream, err error)

func NewACS

func NewACS(base io.ReadWriteCloser) *ACStream

func (*ACStream) Close

func (acs *ACStream) Close() error

func (*ACStream) CloseR

func (acs *ACStream) CloseR() error

func (*ACStream) CloseW

func (acs *ACStream) CloseW() error

func (*ACStream) Destroy

func (acs *ACStream) Destroy()

func (*ACStream) Discard

func (acs *ACStream) Discard(n int) (discarded int, err error)

func (*ACStream) Flush

func (acs *ACStream) Flush()

func (*ACStream) LocalAddr

func (acs *ACStream) LocalAddr() net.Addr

net.Conn

func (*ACStream) Open

func (acs *ACStream) Open() *ACStream

func (*ACStream) Origin

func (acs *ACStream) Origin() interface{}

func (*ACStream) Pick

func (acs *ACStream) Pick(n int) ([]byte, error)

func (*ACStream) Read

func (acs *ACStream) Read(buf []byte) (int, error)

func (*ACStream) ReadLine

func (acs *ACStream) ReadLine() (line []byte, isPrefix bool, err error)

func (*ACStream) Reader

func (acs *ACStream) Reader() *bufio.Reader

func (*ACStream) RemoteAddr

func (acs *ACStream) RemoteAddr() net.Addr

func (*ACStream) SetDeadline

func (acs *ACStream) SetDeadline(t time.Time) error

func (*ACStream) SetReadDeadline

func (acs *ACStream) SetReadDeadline(t time.Time) error

func (*ACStream) SetWriteDeadline

func (acs *ACStream) SetWriteDeadline(t time.Time) error

func (*ACStream) Write

func (acs *ACStream) Write(buf []byte) (int, error)

func (*ACStream) Writer

func (acs *ACStream) Writer() *bufio.Writer

type Config

type Config struct {
	HelloPageUrl string
	ServerName   string
	LogFlags     int
	LogOut       io.Writer
	LogFile      string

	Listen           string
	Certificate      string
	CertKey          string
	ReadTimeout      int
	IdleTimeout      int
	WriteTimeout     int
	LolFile          string
	ServerMode       bool
	Remote           string
	HttpEnable       bool
	CacheDir         string
	LogChan          chan interface{}
	Context          context.Context
	SessionCacheDir  string
	OnlyCacheRequest bool
	DecryptHttps     bool
	CertCache        string
	// contains filtered or unexported fields
}

type Flusher

type Flusher interface {
	Flush()
}

type JournalReadWriter

type JournalReadWriter struct {
	io.ReadWriteCloser
	// contains filtered or unexported fields
}

func NewJRW

func NewJRW(origin io.ReadWriteCloser, readJournal, writerJournal string) (jrw *JournalReadWriter, err error)

func (*JournalReadWriter) Close

func (jrw *JournalReadWriter) Close() (err error)

func (*JournalReadWriter) Flush

func (jrw *JournalReadWriter) Flush()

func (*JournalReadWriter) Read

func (jrw *JournalReadWriter) Read(buf []byte) (n int, err error)

func (*JournalReadWriter) Write

func (jrw *JournalReadWriter) Write(buf []byte) (n int, err error)

Jump to

Keyboard shortcuts

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