MCPcopy
hub / github.com/cloudflare/cloudflared / NewControlStream

Function NewControlStream

connection/control.go:49–76  ·  view source on GitHub ↗

NewControlStream returns a new instance of ControlStreamHandler

(
	observer *Observer,
	connectedFuse ConnectedFuse,
	tunnelProperties *TunnelProperties,
	connIndex uint8,
	edgeAddress net.IP,
	registerClientFunc registerClientFunc,
	registerTimeout time.Duration,
	gracefulShutdownC <-chan struct{},
	gracePeriod time.Duration,
	protocol Protocol,
)

Source from the content-addressed store, hash-verified

47
48// NewControlStream returns a new instance of ControlStreamHandler
49func NewControlStream(
50 observer *Observer,
51 connectedFuse ConnectedFuse,
52 tunnelProperties *TunnelProperties,
53 connIndex uint8,
54 edgeAddress net.IP,
55 registerClientFunc registerClientFunc,
56 registerTimeout time.Duration,
57 gracefulShutdownC <-chan struct{},
58 gracePeriod time.Duration,
59 protocol Protocol,
60) ControlStreamHandler {
61 if registerClientFunc == nil {
62 registerClientFunc = tunnelrpc.NewRegistrationClient
63 }
64 return &controlStream{
65 observer: observer,
66 connectedFuse: connectedFuse,
67 tunnelProperties: tunnelProperties,
68 registerClientFunc: registerClientFunc,
69 registerTimeout: registerTimeout,
70 connIndex: connIndex,
71 edgeAddress: edgeAddress,
72 gracefulShutdownC: gracefulShutdownC,
73 gracePeriod: gracePeriod,
74 protocol: protocol,
75 }
76}
77
78func (c *controlStream) ServeControlStream(
79 ctx context.Context,

Callers 5

serveConnectionMethod · 0.92
newTestHTTP2ConnectionFunction · 0.85
TestServeControlStreamFunction · 0.85
TestFailRegistrationFunction · 0.85

Calls

no outgoing calls

Tested by 4

newTestHTTP2ConnectionFunction · 0.68
TestServeControlStreamFunction · 0.68
TestFailRegistrationFunction · 0.68