refactor(worker): Move tcp_proxy into its own package (#1458)
* refactor(worker): Move tcp_proxy into its own package This refactors: - the tcp_proxy.go into worker/proxy/tcp - add a missing unit test for the HandleTcpProxyV1 - refactors session.go into worker/session, needed to avoid import cycle - adds a baseline for a mock controller session client - go lint fixes * Add sleep between spinning listener goroutine and dialing Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
1 parent
c79daab68c
commit
31af49e76d
29 files changed
+1229
-773
No files matched your search
@@ -25,7 +25,7 @@ type SessionServiceClient interface {
|
||||
ActivateSession(ctx context.Context, in *ActivateSessionRequest, opts ...grpc.CallOption) (*ActivateSessionResponse, error)
|
||||
// CancelSession allows a worker to request that the controller cancel a session.
|
||||
CancelSession(ctx context.Context, in *CancelSessionRequest, opts ...grpc.CallOption) (*CancelSessionResponse, error)
|
||||
// AuthorizeConnection allows a worker to activate a session on a controller.
|
||||
// AuthorizeConnection allows a worker to authorize a connection on a controller.
|
||||
AuthorizeConnection(ctx context.Context, in *AuthorizeConnectionRequest, opts ...grpc.CallOption) (*AuthorizeConnectionResponse, error)
|
||||
// ConnectConnection updates a connection to set it to connected
|
||||
ConnectConnection(ctx context.Context, in *ConnectConnectionRequest, opts ...grpc.CallOption) (*ConnectConnectionResponse, error)
|
||||
@@ -106,7 +106,7 @@ type SessionServiceServer interface {
|
||||
ActivateSession(context.Context, *ActivateSessionRequest) (*ActivateSessionResponse, error)
|
||||
// CancelSession allows a worker to request that the controller cancel a session.
|
||||
CancelSession(context.Context, *CancelSessionRequest) (*CancelSessionResponse, error)
|
||||
// AuthorizeConnection allows a worker to activate a session on a controller.
|
||||
// AuthorizeConnection allows a worker to authorize a connection on a controller.
|
||||
AuthorizeConnection(context.Context, *AuthorizeConnectionRequest) (*AuthorizeConnectionResponse, error)
|
||||
// ConnectConnection updates a connection to set it to connected
|
||||
ConnectConnection(context.Context, *ConnectConnectionRequest) (*ConnectConnectionResponse, error)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// TODO (lcr 08/2021): implement mockSessionServiceClient outside of primitive support for
|
||||
// ConnectConnection
|
||||
type mockSessionServiceClient struct{}
|
||||
|
||||
func NewMockSessionServiceClient() SessionServiceClient {
|
||||
return &mockSessionServiceClient{}
|
||||
}
|
||||
|
||||
func (c *mockSessionServiceClient) LookupSession(_ context.Context, _ *LookupSessionRequest, _ ...grpc.CallOption) (*LookupSessionResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *mockSessionServiceClient) ActivateSession(_ context.Context, _ *ActivateSessionRequest, _ ...grpc.CallOption) (*ActivateSessionResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *mockSessionServiceClient) CancelSession(_ context.Context, _ *CancelSessionRequest, _ ...grpc.CallOption) (*CancelSessionResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *mockSessionServiceClient) AuthorizeConnection(_ context.Context, _ *AuthorizeConnectionRequest, _ ...grpc.CallOption) (*AuthorizeConnectionResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *mockSessionServiceClient) ConnectConnection(_ context.Context, _ *ConnectConnectionRequest, _ ...grpc.CallOption) (*ConnectConnectionResponse, error) {
|
||||
return &ConnectConnectionResponse{
|
||||
Status: CONNECTIONSTATUS_CONNECTIONSTATUS_CONNECTED,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *mockSessionServiceClient) CloseConnection(_ context.Context, _ *CloseConnectionRequest, _ ...grpc.CallOption) (*CloseConnectionResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
Reference in new issue
Block a user