- Reorganize internal packages and overall project structure - Update imports and wiring to match the new layout - Separate HTTP parsing and streaming from the server package - Separate middleware from the server package - Separate session registry from the session package - Move HTTP, HTTPS, and TCP servers to the transport package - Session package no longer starts the TCP server directly - Server package no longer starts HTTP/HTTPS servers on initialization - Forwarder no longer handles accepting TCP requests - Move session details to the types package - HTTP/HTTPS initialization is now the responsibility of main
44 lines
727 B
Go
44 lines
727 B
Go
package types
|
|
|
|
import "time"
|
|
|
|
type Status int
|
|
|
|
const (
|
|
INITIALIZING Status = iota
|
|
RUNNING
|
|
)
|
|
|
|
type Mode int
|
|
|
|
const (
|
|
INTERACTIVE Mode = iota
|
|
HEADLESS
|
|
)
|
|
|
|
type TunnelType int
|
|
|
|
const (
|
|
UNKNOWN TunnelType = iota
|
|
HTTP
|
|
TCP
|
|
)
|
|
|
|
type SessionKey struct {
|
|
Id string
|
|
Type TunnelType
|
|
}
|
|
|
|
type Detail struct {
|
|
ForwardingType string `json:"forwarding_type,omitempty"`
|
|
Slug string `json:"slug,omitempty"`
|
|
UserID string `json:"user_id,omitempty"`
|
|
Active bool `json:"active,omitempty"`
|
|
StartedAt time.Time `json:"started_at,omitempty"`
|
|
}
|
|
|
|
var BadGatewayResponse = []byte("HTTP/1.1 502 Bad Gateway\r\n" +
|
|
"Content-Length: 11\r\n" +
|
|
"Content-Type: text/plain\r\n\r\n" +
|
|
"Bad Gateway")
|