chshare

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 31 Imported by: 35

Documentation

Index

Constants

View Source
const DetermRandIter = 2048
View Source
const ProtocolVersion = "chisel-v3"

ProtocolVersion of chisel. When backwards incompatible changes are made, this will be incremented to signify a protocol mismatch.

Variables

View Source
var BuildVersion = "0.0.0-src"
View Source
var UserAllowAll = regexp.MustCompile("")

Functions

func EncodeConfig

func EncodeConfig(c *Config) ([]byte, error)

func FingerprintKey

func FingerprintKey(k ssh.PublicKey) string

func GenerateKey

func GenerateKey(seed string) ([]byte, error)

func GoStats

func GoStats()

GoStats prints statistics to stdout on SIGUSR2 (posix-only)

func HandleSocksStream

func HandleSocksStream(l *Logger, server *socks5.Server, connStats *ConnStats, src io.ReadWriteCloser)

func HandleTCPStream

func HandleTCPStream(l *Logger, connStats *ConnStats, src io.ReadWriteCloser, remote string)

func NewDetermRand

func NewDetermRand(seed []byte) io.Reader

func NewRWCConn

func NewRWCConn(rwc io.ReadWriteCloser) net.Conn

func NewWebSocketConn

func NewWebSocketConn(websocketConn *websocket.Conn) net.Conn

func ParseAuth

func ParseAuth(auth string) (string, string)

func Pipe

func Pipe(src io.ReadWriteCloser, dst io.ReadWriteCloser) (int64, int64)

func SleepSignal

func SleepSignal(d time.Duration)

SleepSignal sleeps for the given duration, or until a SIGHUP is received

Types

type Config

type Config struct {
	Version string
	Remotes []*Remote
}

func DecodeConfig

func DecodeConfig(b []byte) (*Config, error)

type ConnStats

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

func (*ConnStats) Close

func (c *ConnStats) Close()

func (*ConnStats) New

func (c *ConnStats) New() int32

func (*ConnStats) Open

func (c *ConnStats) Open()

func (*ConnStats) String

func (c *ConnStats) String() string

type DetermRand

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

func (*DetermRand) Read

func (d *DetermRand) Read(b []byte) (int, error)

type GetSSHConn

type GetSSHConn func() ssh.Conn

type HTTPServer

type HTTPServer struct {
	*http.Server
	// contains filtered or unexported fields
}

HTTPServer extends net/http Server and adds graceful shutdowns

func NewHTTPServer

func NewHTTPServer() *HTTPServer

NewHTTPServer creates a new HTTPServer

func (*HTTPServer) Close

func (h *HTTPServer) Close() error

func (*HTTPServer) GoListenAndServe

func (h *HTTPServer) GoListenAndServe(addr string, handler http.Handler) error

func (*HTTPServer) Wait

func (h *HTTPServer) Wait() error

type Logger

type Logger struct {
	Info, Debug bool
	// contains filtered or unexported fields
}

Logger is ...

func NewLogger

func NewLogger(prefix string) *Logger

func NewLoggerFlag

func NewLoggerFlag(prefix string, flag int) *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(f string, args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(f string, args ...interface{}) error

func (*Logger) Fork

func (l *Logger) Fork(prefix string, args ...interface{}) *Logger

func (*Logger) Infof

func (l *Logger) Infof(f string, args ...interface{})

func (*Logger) Prefix

func (l *Logger) Prefix() string

type Remote

type Remote struct {
	LocalHost, LocalPort, RemoteHost, RemotePort string
	Socks, Reverse                               bool
}

func DecodeRemote

func DecodeRemote(s string) (*Remote, error)

func (*Remote) Remote

func (r *Remote) Remote() string

func (*Remote) String

func (r *Remote) String() string

implement Stringer

type TCPProxy

type TCPProxy struct {
	*Logger
	// contains filtered or unexported fields
}

func NewTCPProxy

func NewTCPProxy(logger *Logger, ssh GetSSHConn, index int, remote *Remote) *TCPProxy

func (*TCPProxy) Start

func (p *TCPProxy) Start(ctx context.Context) error

type User

type User struct {
	Name  string
	Pass  string
	Addrs []*regexp.Regexp
}

func (*User) HasAccess

func (u *User) HasAccess(addr string) bool

type UserIndex

type UserIndex struct {
	*Logger
	*Users
	// contains filtered or unexported fields
}

UserIndex is a reloadable user source

func NewUserIndex

func NewUserIndex(logger *Logger) *UserIndex

NewUserIndex creates a source for users

func (*UserIndex) LoadUsers

func (u *UserIndex) LoadUsers(configFile string) error

LoadUsers is responsible for loading users from a file

type Users

type Users struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewUsers

func NewUsers() *Users

func (*Users) AddUser

func (u *Users) AddUser(user *User)

AddUser adds a users to the list

func (*Users) Del

func (u *Users) Del(key string)

Delete a users from the list

func (*Users) Get

func (u *Users) Get(key string) (*User, bool)

Get user from the index by key

func (*Users) Len

func (u *Users) Len() int

Len returns the numbers of users

func (*Users) Set

func (u *Users) Set(key string, user *User)

Set a users into the list by specific key

Jump to

Keyboard shortcuts

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