webdebugger

package module
v0.0.0-...-4b89dba Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//LogLevelDebug is debug log level
	LogLevelDebug = 40
	//LogLevelInfo is info log level
	LogLevelInfo = 30
	//LogLevelWarn is warn log level
	LogLevelWarn = 20
	//LogLevelError is error log level
	LogLevelError = 10
)

Variables

View Source
var BasePipe = os.Pipe

BasePipe is func to create os pipe

Functions

func DebugLog

func DebugLog(format string, args ...interface{})

DebugLog is the debug level log

func ErrorLog

func ErrorLog(format string, args ...interface{})

ErrorLog is the error level log

func InfoLog

func InfoLog(format string, args ...interface{})

InfoLog is the info level log

func ReadJSON

func ReadJSON(filename string, v interface{}) (err error)

ReadJSON will read file and unmarshal to value

func SHA1

func SHA1(data []byte) string

SHA1 will get sha1 hash of data

func SetLogLevel

func SetLogLevel(l int)

SetLogLevel is set log level to l

func WarnLog

func WarnLog(format string, args ...interface{})

WarnLog is the warn level log

Types

type Config

type Config struct {
	Hosts    []*ConfigHost            `json:"hosts"`
	Decorder []map[string]interface{} `json:"decorder"`
}

Config is pojo to debuger configure

type ConfigHost

type ConfigHost struct {
	Host        string `json:"host"`
	IP          string `json:"ip"`
	Decorder    string `json:"decorder"`
	Forward     string `json:"forward"`
	DumpRequest int    `json:"dump_request"`
}

ConfigHost is pojo to debuger configure

type Debuger

type Debuger struct {
	*Config

	Decorder DecorderCreator
	// contains filtered or unexported fields
}

Debuger provider the web debuger suppported

func NewDebuger

func NewDebuger(config *Config) (debuger *Debuger)

NewDebuger will return new Debuger

func (*Debuger) Accept

func (d *Debuger) Accept() (conn net.Conn, err error)

Accept will accept on conn from queue

func (*Debuger) Addr

func (d *Debuger) Addr() net.Addr

Addr returns the listener's network address.

func (*Debuger) Close

func (d *Debuger) Close() (err error)

Close will close all server

func (*Debuger) Network

func (d *Debuger) Network() string

Network is impl to net.Addr

func (*Debuger) ProcConn

func (d *Debuger) ProcConn(uri string, raw net.Conn) (async bool, err error)

ProcConn will proc raw connection to uri

func (*Debuger) Serve

func (d *Debuger) Serve() (err error)

Serve will start the http proxy server

func (*Debuger) ServeHTTP

func (d *Debuger) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Debuger) String

func (d *Debuger) String() string

type Decorder

type Decorder interface {
	Decord(host string, raw net.Conn) (conn net.Conn, err error)
}

Decorder is an interface to decord raw connection by host

func DefaultDecorderCreator

func DefaultDecorderCreator(name string, config map[string]interface{}) (decorder Decorder, err error)

DefaultDecorderCreator will create Decorder by name, supported type is TlsDecorder

type DecorderCreator

type DecorderCreator func(name string, config map[string]interface{}) (decorder Decorder, err error)

DecorderCreator is a func define to create Decorder by configure

type PipedConn

type PipedConn struct {
	io.Reader
	io.Writer
	Alias string
}

PipedConn is connection piped read and write

func CreatePipeConn

func CreatePipeConn() (a, b *PipedConn, err error)

CreatePipeConn will create pipe connection

func (*PipedConn) Close

func (p *PipedConn) Close() (err error)

Close will close Reaer/Writer

func (*PipedConn) LocalAddr

func (p *PipedConn) LocalAddr() net.Addr

LocalAddr is net.Conn impl

func (*PipedConn) Network

func (p *PipedConn) Network() string

Network is net.Addr impl

func (*PipedConn) RemoteAddr

func (p *PipedConn) RemoteAddr() net.Addr

RemoteAddr is net.Conn impl

func (*PipedConn) SetDeadline

func (p *PipedConn) SetDeadline(t time.Time) error

SetDeadline is net.Conn impl

func (*PipedConn) SetReadDeadline

func (p *PipedConn) SetReadDeadline(t time.Time) error

SetReadDeadline is net.Conn impl

func (*PipedConn) SetWriteDeadline

func (p *PipedConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline is net.Conn impl

func (*PipedConn) String

func (p *PipedConn) String() string

type SocksProxy

type SocksProxy struct {
	net.Listener
	HTTPUpstream string
	ProcConn     func(uri string, raw net.Conn) (async bool, err error)
}

SocksProxy is an implementation of socks5 proxy

func NewSocksProxy

func NewSocksProxy() (socks *SocksProxy)

NewSocksProxy will return new SocksProxy

func (*SocksProxy) Listen

func (s *SocksProxy) Listen(addr string) (err error)

Listen the address

func (*SocksProxy) Run

func (s *SocksProxy) Run() (err error)

Run proxy listener

type StringConn

type StringConn struct {
	Name string
	net.Conn
}

StringConn is an ReadWriteCloser for return remote address info

func NewStringConn

func NewStringConn(raw net.Conn) *StringConn

NewStringConn will return new StringConn

func (*StringConn) String

func (s *StringConn) String() string

type TCPKeepAliveListener

type TCPKeepAliveListener struct {
	*net.TCPListener
}

TCPKeepAliveListener is normal tcp listner for set tcp connection keep alive

func (TCPKeepAliveListener) Accept

func (ln TCPKeepAliveListener) Accept() (net.Conn, error)

Accept will accept one connection

type TLSCertCenter

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

TLSCertCenter provider cert server and it will service the TLSDecorder

func NewTLSCertCenter

func NewTLSCertCenter(certs ...map[string]interface{}) (center *TLSCertCenter)

NewTLSCertCenter will return new TLSCertCenter by cert configure

func (*TLSCertCenter) ServeHTTP

func (t *TLSCertCenter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TLSDecorder

type TLSDecorder struct {
	Name      string
	Server    string
	Username  string
	Password  string
	Cert, Key string
	// contains filtered or unexported fields
}

TLSDecorder provider Decorder to decord conenction by tls cert

func NewTLSDecorder

func NewTLSDecorder() (decorder *TLSDecorder)

NewTLSDecorder will create new TLSDecorder

func (*TLSDecorder) Decord

func (t *TLSDecorder) Decord(host string, raw net.Conn) (conn net.Conn, err error)

Decord will decord raw connection by host

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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