Documentation ¶
Index ¶
Constants ¶
View Source
const ( TokenHeaderName = "X-Auth-Token" UserIdHeaderName = "X-Auth-Id" )
View Source
const ( TypeOpen uint8 = 1 + iota TypeOpenSuccess TypePacket TypeMessage TypePing TypePong )
View Source
const ( SocketErrorCodeInvalidProtocol = 1 + iota SocketErrorCodeRequestAuth SocketErrorCodeNotAccessible SocketErrorCodeCloseConnection )
View Source
const (
SocketProxyNextProto = "lpsc1"
)
Variables ¶
View Source
var ( SocketErrorInvalidProtocol = NewMessageError(SocketErrorCodeInvalidProtocol, "invalid protocol") SocketErrorRequestAuth = NewMessageError(SocketErrorCodeRequestAuth, "need authenticate") SocketErrorNotAccessible = NewMessageError(SocketErrorCodeNotAccessible, "You don't have privilege") SocketErrorCloseConnection = NewMessageError(SocketErrorCodeCloseConnection, "Sorry, the server has close connection") )
View Source
var (
HeartbeatInterval = 30 * time.Second
)
Functions ¶
This section is empty.
Types ¶
type AccessLog ¶
type AccessLog struct { Host string `json:"host"` Protocol string `json:"protocol"` Method string `json:"method"` Path string `json:"path"` Status int `json:"status"` UserAgent string `json:"user_agent"` ClientIp string `json:"client_ip"` AppTime int `json:"app_time_ms"` RequestId string `json:"request_id"` UserId string `json:"user_id"` }
type Client ¶ added in v0.3.2
type Client struct {
// contains filtered or unexported fields
}
func NewSocketProxyClient ¶ added in v0.3.2
type ErrorTokenAuthorization ¶ added in v0.3.2
type ErrorTokenAuthorization struct {
Endpoint string
}
func (*ErrorTokenAuthorization) Error ¶ added in v0.3.2
func (e *ErrorTokenAuthorization) Error() string
type FrontendProxy ¶
func NewFrontendProxy ¶
func (*FrontendProxy) ServeHTTP ¶
func (p *FrontendProxy) ServeHTTP(w http.ResponseWriter, req *http.Request)
type MessageError ¶
type MessageError interface { error Code() int Message() string Params() url.Values Clone() MessageError }
func NewMessageError ¶
func NewMessageError(code int, message string) MessageError
func ParseMessageError ¶
func ParseMessageError(v url.Values) (MessageError, error)
type SocketProxy ¶
func NewSocketProxy ¶
func NewSocketProxy(conf *config.Config, ct *connector.Server) *SocketProxy
func (*SocketProxy) Accept ¶
func (s *SocketProxy) Accept(_ *http.Server, conn tlsConn, _ http.Handler)
Accept handles incoming connection. conn is an established connection that is finished handshake.
func (*SocketProxy) Shutdown ¶
func (s *SocketProxy) Shutdown()
Click to show internal directories.
Click to hide internal directories.