Documentation
¶
Index ¶
- func CloseTunnel(client *ClientHub, content []byte)
- func ConvertToMessage(mt MessageType, content []byte) []byte
- func Error(c *websocket.Conn, hub *ClientHub)
- func GenerateCloseTunnelMsg(id uuid.UUID) []byte
- func GeneratePing() []byte
- func GeneratePong() []byte
- func HandleDataReceive(client *ClientHub, msg []byte)
- func HandleMetrics(client *ClientHub) int
- func MarshalObject(o any) ([]byte, error)
- func Reader(c *websocket.Conn, hub *ClientHub)
- func TunnelError(client *ClientHub, connID uuid.UUID)
- func TunnelReader(client *ClientHub, connID uuid.UUID)
- func TunnelWriter(client *ClientHub, connID uuid.UUID)
- func UnmarshalObject(data []byte, v any) error
- func Writer(c *websocket.Conn, hub *ClientHub)
- type Client
- type ClientHub
- type IunctioActiveTunnel
- type IunctioClient
- type IunctioClientLogin
- type LoggerStub
- type Message
- type MessageType
- type Tunnel
- type TunnelData
- type TunnelInit
- type TunnelStart
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseTunnel ¶
func ConvertToMessage ¶
func ConvertToMessage(mt MessageType, content []byte) []byte
func GenerateCloseTunnelMsg ¶
func GeneratePing ¶
func GeneratePing() []byte
func GeneratePong ¶
func GeneratePong() []byte
func HandleDataReceive ¶
func HandleMetrics ¶
func MarshalObject ¶
func TunnelError ¶
func TunnelReader ¶
Take information from the TCP connection specified by connID and send it to the client application via websockets. This is "reading" from the TCP connection and dropping the information into the channels
func TunnelWriter ¶
func UnmarshalObject ¶
Types ¶
type ClientHub ¶
type ClientHub struct {
Reader chan []byte
Writer chan []byte
Control chan int
Tunnels []Tunnel // Tunnels the client is sending to the server
ActiveConns map[uuid.UUID](IunctioActiveTunnel) // Active network connections the
LoginID uuid.UUID // The UUID used for logging in
Hostname string // The hostname
Namespace string // What k8s namespace to put this in
CloseChan chan os.Signal // Used to close client
// Metrics
MetricsChan chan []*io_prometheus_client.MetricFamily
MetricsServer *http.Server
MetricsPort int
}
This is a struct to hold information about the client that is connected to the server. This should have information about the client connection itself and any tunnels/connections that are available. This allows the server to safely discard resources in the case of a client disconnect.
func NewClientHub ¶
func NewClientHub() *ClientHub
type IunctioActiveTunnel ¶
type IunctioActiveTunnel struct {
Id uuid.UUID // The UUID of the tunnel
Conn net.Conn // The network connection
Reader chan []byte // The channel that will send data to the other end of this tcp socket
Control chan []byte
ThreadsRunning bool
}
This struct contains members that describe an active tunnel connection and associated data. This includes the net.Conn structure, required channels, and more.
func NewIunctioActiveTunnel ¶
func NewIunctioActiveTunnel(conn net.Conn) *IunctioActiveTunnel
type IunctioClient ¶
type IunctioClient struct {
gorm.Model
IunctioClientLogin `gorm:"embedded"`
Namespace string // What k8s namespace to put this in
}
type IunctioClientLogin ¶
type LoggerStub ¶
type LoggerStub struct {
}
func (LoggerStub) Log ¶
func (l LoggerStub) Log(keyvals ...interface{}) error
This function is called each time a metric is requested from each processor. It will produce a lot of output if you add anything here
type Message ¶
type Message struct {
Type MessageType
Content []byte
}
type MessageType ¶
type MessageType int
const ( TunnelMessageType MessageType = iota AdminMessageType RequestAuthenticationMsgType ResponseCredentialsMsgType ResponseAuthenticationSuccessMsgType RequestTunnelDescriptionsMsgType ResponseTunnelDescriptionsMsgType RequestTunnelInitMsgType ResponseTunnelInitMsgType // Basically yeah or nah RequestTunnelCloseMsgType ResponseTunnelCloseMsgType TunnelDataMsgType // Either direction PingDataMsgType PongDataMsgType RequestMetricsMsgType // For metrics, Server asking client ResponseMetricsReportMsgType // For metrics, client responding to server ClientGoodbyeMessageType )