Documentation ¶
Index ¶
Constants ¶
const ( HeartbeatInterval = time.Second CheckInterval = time.Second * 5 )
const ( SessionIDHeaderKey = "X-Tunnel-Session-ID" BufferSize = 4096 )
Variables ¶
This section is empty.
Functions ¶
func Heartbeat ¶
Heartbeat send heartbeat byte to stub requester each HeartbeatInterval in order to maintain connection. Otherwise, requester will decrease the health of this connection and in the end kick it off.
func StartHealthzServer ¶
Types ¶
type AgentMeta ¶
type AgentMeta struct { Provider string `json:"provider"` K8sVersion string `json:"k8sversion"` IsIntranet string `json:"isintranet"` CustomizeCommand string `json:"customizecommand"` Data map[string]string `json:"data"` }
Note: Any change to this struct needs to update DeepCopy function as well.
type Heart ¶
type Heart struct {
// contains filtered or unexported fields
}
func (*Heart) CheckCluster ¶
func (h *Heart) CheckCluster()
type StubMeta ¶
type StubMeta struct { State TunnelState `json:"state"` ActiveCluster string `json:"active_cluster"` AgentsMeta map[string]AgentMeta `json:"agents_meta"` Version string `json:"version"` }
type StubMetaProviderFunc ¶
type StubMetaProviderFunc func() StubMeta
type TunnelEndpoint ¶
type TunnelEndpoint struct {
Component
}
TunnelEndpoint is initially designed for common parts of stub and agent.
func NewTunnelEndpoint ¶
func NewTunnelEndpoint(ctx context.Context, logger *logrus.Logger) TunnelEndpoint
func (*TunnelEndpoint) CheckAndStartPipe ¶
func (endpoint *TunnelEndpoint) CheckAndStartPipe(request *http.Request, response *http.Response, endpointA io.ReadWriter, endpointB io.ReadWriter)
CheckAndStartPipe will check request header and response status code to see if there is a successful upgrade negotiation. The order of endpointA and endpointB only affect to log, A2B is forward and B2A is backward. X2Y means read from X and write to Y. This pipe is a full duplex pipe. The close of this pipe is caused by either context done or any error from any connection. The data is read in SPDY format where the auxiliary function `readSPDYFrame` does. Reference: https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1 section 2.2.
type TunnelState ¶
type TunnelState string