Documentation ¶
Index ¶
- Variables
- func CheckPort(port uint32, portRanges string) (uint32, error)
- func CommaSplitFields(c rune) bool
- func GetOpenAlias(addr string, port string, state *State, sshConn *SSHConnection) string
- func GetOpenHost(addr string, state *State, sshConn *SSHConnection) string
- func GetRandomPortInRange(portRange string) uint32
- func GetSSHConfig() *ssh.ServerConfig
- func RandStringBytesMaskImprSrc(n int) string
- func Setup()
- func WatchCerts()
- type ProxyHolder
- type SSHConnection
- type State
- type WebClient
- type WebConsole
- func (c *WebConsole) AddClient(route string, w *WebClient)
- func (c *WebConsole) AddRoute(route string, token string)
- func (c *WebConsole) BroadcastRoute(route string, message []byte)
- func (c *WebConsole) HandleAllRoutes(hostname string, g *gin.Context)
- func (c *WebConsole) HandleClients(hostname string, g *gin.Context)
- func (c *WebConsole) HandleDisconnectClient(hostname string, g *gin.Context)
- func (c *WebConsole) HandleDisconnectRoute(hostname string, g *gin.Context)
- func (c *WebConsole) HandleRequest(hostname string, hostIsRoot bool, g *gin.Context)
- func (c *WebConsole) HandleRoutes(hostname string, g *gin.Context)
- func (c *WebConsole) HandleTemplate(hostname string, hostIsRoot bool, userIsAdmin bool, g *gin.Context)
- func (c *WebConsole) HandleWebSocket(hostname string, g *gin.Context)
- func (c *WebConsole) RemoveClient(route string, w *WebClient)
- func (c *WebConsole) RemoveRoute(route string)
- func (c *WebConsole) RouteExists(route string) bool
Constants ¶
This section is empty.
Variables ¶
var ( // Filter is the IPFilter used to block connections Filter *ipfilter.IPFilter )
Functions ¶
func CommaSplitFields ¶
CommaSplitFields is a function used by strings.FieldsFunc to split around commas
func GetOpenAlias ¶
func GetOpenAlias(addr string, port string, state *State, sshConn *SSHConnection) string
GetOpenAlias returns open aliases
func GetOpenHost ¶
func GetOpenHost(addr string, state *State, sshConn *SSHConnection) string
GetOpenHost returns a random open host
func GetRandomPortInRange ¶
GetRandomPortInRange returns a random port in the provided range
func GetSSHConfig ¶
func GetSSHConfig() *ssh.ServerConfig
GetSSHConfig Returns an SSH config for the ssh muxer
func RandStringBytesMaskImprSrc ¶
RandStringBytesMaskImprSrc creates a random string of length n https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang
Types ¶
type ProxyHolder ¶
type ProxyHolder struct { ProxyHost string ProxyTo string Scheme string SSHConn *SSHConnection }
ProxyHolder holds proxy and connection info
type SSHConnection ¶
type SSHConnection struct { SSHConn *ssh.ServerConn Listeners *sync.Map Close chan bool Messages chan string ProxyProto byte Session chan bool CleanupHandler bool }
SSHConnection handles state for a SSHConnection
func (*SSHConnection) CleanUp ¶
func (s *SSHConnection) CleanUp(state *State)
CleanUp closes all allocated resources and cleans them up
func (*SSHConnection) SendMessage ¶
func (s *SSHConnection) SendMessage(message string, block bool)
SendMessage sends a console message to the connection
type State ¶
type State struct { Console *WebConsole SSHConnections *sync.Map Listeners *sync.Map HTTPListeners *sync.Map TCPListeners *sync.Map IPFilter *ipfilter.IPFilter }
State handles overall state
type WebClient ¶
type WebClient struct { Conn *websocket.Conn Console *WebConsole Send chan []byte Route string }
WebClient represents a primitive web console client
type WebConsole ¶
WebConsole represents the data structure that stores web console client information Clients is a map[string][]*WebClient
func (*WebConsole) AddClient ¶
func (c *WebConsole) AddClient(route string, w *WebClient)
AddClient adds a client to the console
func (*WebConsole) AddRoute ¶
func (c *WebConsole) AddRoute(route string, token string)
AddRoute adds a route to the console
func (*WebConsole) BroadcastRoute ¶
func (c *WebConsole) BroadcastRoute(route string, message []byte)
BroadcastRoute sends a message to all clients on a route
func (*WebConsole) HandleAllRoutes ¶
func (c *WebConsole) HandleAllRoutes(hostname string, g *gin.Context)
HandleAllRoutes handles returning all connected routes (tunnels)
func (*WebConsole) HandleClients ¶
func (c *WebConsole) HandleClients(hostname string, g *gin.Context)
HandleClients handles returning all connected clients
func (*WebConsole) HandleDisconnectClient ¶
func (c *WebConsole) HandleDisconnectClient(hostname string, g *gin.Context)
HandleDisconnectClient handles the disconnection request for a client
func (*WebConsole) HandleDisconnectRoute ¶
func (c *WebConsole) HandleDisconnectRoute(hostname string, g *gin.Context)
HandleDisconnectRoute handles the disconnection request for a route
func (*WebConsole) HandleRequest ¶
func (c *WebConsole) HandleRequest(hostname string, hostIsRoot bool, g *gin.Context)
HandleRequest handles an incoming WS request
func (*WebConsole) HandleRoutes ¶
func (c *WebConsole) HandleRoutes(hostname string, g *gin.Context)
HandleRoutes handles returning available http routes to join
func (*WebConsole) HandleTemplate ¶
func (c *WebConsole) HandleTemplate(hostname string, hostIsRoot bool, userIsAdmin bool, g *gin.Context)
HandleTemplate handles rendering the console template
func (*WebConsole) HandleWebSocket ¶
func (c *WebConsole) HandleWebSocket(hostname string, g *gin.Context)
HandleWebSocket handles the websocket route
func (*WebConsole) RemoveClient ¶
func (c *WebConsole) RemoveClient(route string, w *WebClient)
RemoveClient removes a client from the console
func (*WebConsole) RemoveRoute ¶
func (c *WebConsole) RemoveRoute(route string)
RemoveRoute adds a route to the console
func (*WebConsole) RouteExists ¶
func (c *WebConsole) RouteExists(route string) bool
RouteExists check if a route exists