-
Notifications
You must be signed in to change notification settings - Fork 82
/
websockets.go
356 lines (302 loc) · 12.9 KB
/
websockets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
// Code generated by MockGen. DO NOT EDIT.
// Source: pkg/backends/websockets.go
// Package mock_backends is a generated GoMock package.
package mock_backends
import (
context "context"
tls "crypto/tls"
backends "github.com/ansible/receptor/pkg/backends"
netceptor "github.com/ansible/receptor/pkg/netceptor"
gomock "github.com/golang/mock/gomock"
net "net"
http "net/http"
reflect "reflect"
sync "sync"
)
// MockGorillaWebsocketDialerForDialer is a mock of GorillaWebsocketDialerForDialer interface
type MockGorillaWebsocketDialerForDialer struct {
ctrl *gomock.Controller
recorder *MockGorillaWebsocketDialerForDialerMockRecorder
}
// MockGorillaWebsocketDialerForDialerMockRecorder is the mock recorder for MockGorillaWebsocketDialerForDialer
type MockGorillaWebsocketDialerForDialerMockRecorder struct {
mock *MockGorillaWebsocketDialerForDialer
}
// NewMockGorillaWebsocketDialerForDialer creates a new mock instance
func NewMockGorillaWebsocketDialerForDialer(ctrl *gomock.Controller) *MockGorillaWebsocketDialerForDialer {
mock := &MockGorillaWebsocketDialerForDialer{ctrl: ctrl}
mock.recorder = &MockGorillaWebsocketDialerForDialerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockGorillaWebsocketDialerForDialer) EXPECT() *MockGorillaWebsocketDialerForDialerMockRecorder {
return m.recorder
}
// DialContext mocks base method
func (m *MockGorillaWebsocketDialerForDialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (backends.Conner, *http.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DialContext", ctx, urlStr, requestHeader)
ret0, _ := ret[0].(backends.Conner)
ret1, _ := ret[1].(*http.Response)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
// DialContext indicates an expected call of DialContext
func (mr *MockGorillaWebsocketDialerForDialerMockRecorder) DialContext(ctx, urlStr, requestHeader interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DialContext", reflect.TypeOf((*MockGorillaWebsocketDialerForDialer)(nil).DialContext), ctx, urlStr, requestHeader)
}
// MockWebsocketListenerForWebsocket is a mock of WebsocketListenerForWebsocket interface
type MockWebsocketListenerForWebsocket struct {
ctrl *gomock.Controller
recorder *MockWebsocketListenerForWebsocketMockRecorder
}
// MockWebsocketListenerForWebsocketMockRecorder is the mock recorder for MockWebsocketListenerForWebsocket
type MockWebsocketListenerForWebsocketMockRecorder struct {
mock *MockWebsocketListenerForWebsocket
}
// NewMockWebsocketListenerForWebsocket creates a new mock instance
func NewMockWebsocketListenerForWebsocket(ctrl *gomock.Controller) *MockWebsocketListenerForWebsocket {
mock := &MockWebsocketListenerForWebsocket{ctrl: ctrl}
mock.recorder = &MockWebsocketListenerForWebsocketMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockWebsocketListenerForWebsocket) EXPECT() *MockWebsocketListenerForWebsocketMockRecorder {
return m.recorder
}
// Addr mocks base method
func (m *MockWebsocketListenerForWebsocket) Addr() net.Addr {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Addr")
ret0, _ := ret[0].(net.Addr)
return ret0
}
// Addr indicates an expected call of Addr
func (mr *MockWebsocketListenerForWebsocketMockRecorder) Addr() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Addr", reflect.TypeOf((*MockWebsocketListenerForWebsocket)(nil).Addr))
}
// GetAddr mocks base method
func (m *MockWebsocketListenerForWebsocket) GetAddr() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetAddr")
ret0, _ := ret[0].(string)
return ret0
}
// GetAddr indicates an expected call of GetAddr
func (mr *MockWebsocketListenerForWebsocketMockRecorder) GetAddr() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAddr", reflect.TypeOf((*MockWebsocketListenerForWebsocket)(nil).GetAddr))
}
// GetTLS mocks base method
func (m *MockWebsocketListenerForWebsocket) GetTLS() *tls.Config {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetTLS")
ret0, _ := ret[0].(*tls.Config)
return ret0
}
// GetTLS indicates an expected call of GetTLS
func (mr *MockWebsocketListenerForWebsocketMockRecorder) GetTLS() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTLS", reflect.TypeOf((*MockWebsocketListenerForWebsocket)(nil).GetTLS))
}
// Path mocks base method
func (m *MockWebsocketListenerForWebsocket) Path() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Path")
ret0, _ := ret[0].(string)
return ret0
}
// Path indicates an expected call of Path
func (mr *MockWebsocketListenerForWebsocketMockRecorder) Path() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Path", reflect.TypeOf((*MockWebsocketListenerForWebsocket)(nil).Path))
}
// SetPath mocks base method
func (m *MockWebsocketListenerForWebsocket) SetPath(path string) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetPath", path)
}
// SetPath indicates an expected call of SetPath
func (mr *MockWebsocketListenerForWebsocketMockRecorder) SetPath(path interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPath", reflect.TypeOf((*MockWebsocketListenerForWebsocket)(nil).SetPath), path)
}
// Start mocks base method
func (m *MockWebsocketListenerForWebsocket) Start(ctx context.Context, wg *sync.WaitGroup) (chan netceptor.BackendSession, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Start", ctx, wg)
ret0, _ := ret[0].(chan netceptor.BackendSession)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Start indicates an expected call of Start
func (mr *MockWebsocketListenerForWebsocketMockRecorder) Start(ctx, wg interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockWebsocketListenerForWebsocket)(nil).Start), ctx, wg)
}
// MockGorillaWebsocketUpgraderForListener is a mock of GorillaWebsocketUpgraderForListener interface
type MockGorillaWebsocketUpgraderForListener struct {
ctrl *gomock.Controller
recorder *MockGorillaWebsocketUpgraderForListenerMockRecorder
}
// MockGorillaWebsocketUpgraderForListenerMockRecorder is the mock recorder for MockGorillaWebsocketUpgraderForListener
type MockGorillaWebsocketUpgraderForListenerMockRecorder struct {
mock *MockGorillaWebsocketUpgraderForListener
}
// NewMockGorillaWebsocketUpgraderForListener creates a new mock instance
func NewMockGorillaWebsocketUpgraderForListener(ctrl *gomock.Controller) *MockGorillaWebsocketUpgraderForListener {
mock := &MockGorillaWebsocketUpgraderForListener{ctrl: ctrl}
mock.recorder = &MockGorillaWebsocketUpgraderForListenerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockGorillaWebsocketUpgraderForListener) EXPECT() *MockGorillaWebsocketUpgraderForListenerMockRecorder {
return m.recorder
}
// Upgrade mocks base method
func (m *MockGorillaWebsocketUpgraderForListener) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (backends.Conner, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Upgrade", w, r, responseHeader)
ret0, _ := ret[0].(backends.Conner)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Upgrade indicates an expected call of Upgrade
func (mr *MockGorillaWebsocketUpgraderForListenerMockRecorder) Upgrade(w, r, responseHeader interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upgrade", reflect.TypeOf((*MockGorillaWebsocketUpgraderForListener)(nil).Upgrade), w, r, responseHeader)
}
// MockHttpServerForListener is a mock of HttpServerForListener interface
type MockHttpServerForListener struct {
ctrl *gomock.Controller
recorder *MockHttpServerForListenerMockRecorder
}
// MockHttpServerForListenerMockRecorder is the mock recorder for MockHttpServerForListener
type MockHttpServerForListenerMockRecorder struct {
mock *MockHttpServerForListener
}
// NewMockHttpServerForListener creates a new mock instance
func NewMockHttpServerForListener(ctrl *gomock.Controller) *MockHttpServerForListener {
mock := &MockHttpServerForListener{ctrl: ctrl}
mock.recorder = &MockHttpServerForListenerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockHttpServerForListener) EXPECT() *MockHttpServerForListenerMockRecorder {
return m.recorder
}
// Serve mocks base method
func (m *MockHttpServerForListener) Serve(l net.Listener) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Serve", l)
ret0, _ := ret[0].(error)
return ret0
}
// Serve indicates an expected call of Serve
func (mr *MockHttpServerForListenerMockRecorder) Serve(l interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Serve", reflect.TypeOf((*MockHttpServerForListener)(nil).Serve), l)
}
// ServeTLS mocks base method
func (m *MockHttpServerForListener) ServeTLS(l net.Listener, certFile, keyFile string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ServeTLS", l, certFile, keyFile)
ret0, _ := ret[0].(error)
return ret0
}
// ServeTLS indicates an expected call of ServeTLS
func (mr *MockHttpServerForListenerMockRecorder) ServeTLS(l, certFile, keyFile interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServeTLS", reflect.TypeOf((*MockHttpServerForListener)(nil).ServeTLS), l, certFile, keyFile)
}
// Close mocks base method
func (m *MockHttpServerForListener) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockHttpServerForListenerMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockHttpServerForListener)(nil).Close))
}
// SetTLSConfig mocks base method
func (m *MockHttpServerForListener) SetTLSConfig(tlscfg *tls.Config) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetTLSConfig", tlscfg)
}
// SetTLSConfig indicates an expected call of SetTLSConfig
func (mr *MockHttpServerForListenerMockRecorder) SetTLSConfig(tlscfg interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTLSConfig", reflect.TypeOf((*MockHttpServerForListener)(nil).SetTLSConfig), tlscfg)
}
// SetHandeler mocks base method
func (m *MockHttpServerForListener) SetHandeler(mux *http.ServeMux) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetHandeler", mux)
}
// SetHandeler indicates an expected call of SetHandeler
func (mr *MockHttpServerForListenerMockRecorder) SetHandeler(mux interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHandeler", reflect.TypeOf((*MockHttpServerForListener)(nil).SetHandeler), mux)
}
// MockConner is a mock of Conner interface
type MockConner struct {
ctrl *gomock.Controller
recorder *MockConnerMockRecorder
}
// MockConnerMockRecorder is the mock recorder for MockConner
type MockConnerMockRecorder struct {
mock *MockConner
}
// NewMockConner creates a new mock instance
func NewMockConner(ctrl *gomock.Controller) *MockConner {
mock := &MockConner{ctrl: ctrl}
mock.recorder = &MockConnerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockConner) EXPECT() *MockConnerMockRecorder {
return m.recorder
}
// Close mocks base method
func (m *MockConner) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockConnerMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockConner)(nil).Close))
}
// ReadMessage mocks base method
func (m *MockConner) ReadMessage() (int, []byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ReadMessage")
ret0, _ := ret[0].(int)
ret1, _ := ret[1].([]byte)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
// ReadMessage indicates an expected call of ReadMessage
func (mr *MockConnerMockRecorder) ReadMessage() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadMessage", reflect.TypeOf((*MockConner)(nil).ReadMessage))
}
// WriteMessage mocks base method
func (m *MockConner) WriteMessage(messageType int, data []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WriteMessage", messageType, data)
ret0, _ := ret[0].(error)
return ret0
}
// WriteMessage indicates an expected call of WriteMessage
func (mr *MockConnerMockRecorder) WriteMessage(messageType, data interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteMessage", reflect.TypeOf((*MockConner)(nil).WriteMessage), messageType, data)
}