Files
threshold/internal/proxy/proxy.pb.go
T
Jeff Mitchell a6cca576a3 Attempt canceling sessions by the client (#831)
* Attempt canceling sessions by the client

In some circumstances (like a Ctrl-C), the client knows it's shutting
down and the TOFU token will be lost. In this case it makes sense to
cancel the session rather than have it time out. This introduces a
command enum to the handshake message which can be used for the client
to send commands to the worker -- in this case the only specified
command is to cancel the session. It doesn't occur if the session is
already timed out or if we can't authorize connections as this generally
means the session is already invalid.
2020-12-16 17:14:47 -05:00

308 lines
11 KiB
Go

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.12.4
// source: worker/proxy/v1/proxy.proto
package proxy
import (
timestamp "github.com/golang/protobuf/ptypes/timestamp"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type HANDSHAKECOMMAND int32
const (
// Note: Unspecified is the desired zero value based on protolint, but for
// our purposes it simply means a normal connection.
HANDSHAKECOMMAND_HANDSHAKECOMMAND_UNSPECIFIED HANDSHAKECOMMAND = 0
HANDSHAKECOMMAND_HANDSHAKECOMMAND_SESSION_CANCEL HANDSHAKECOMMAND = 1
)
// Enum value maps for HANDSHAKECOMMAND.
var (
HANDSHAKECOMMAND_name = map[int32]string{
0: "HANDSHAKECOMMAND_UNSPECIFIED",
1: "HANDSHAKECOMMAND_SESSION_CANCEL",
}
HANDSHAKECOMMAND_value = map[string]int32{
"HANDSHAKECOMMAND_UNSPECIFIED": 0,
"HANDSHAKECOMMAND_SESSION_CANCEL": 1,
}
)
func (x HANDSHAKECOMMAND) Enum() *HANDSHAKECOMMAND {
p := new(HANDSHAKECOMMAND)
*p = x
return p
}
func (x HANDSHAKECOMMAND) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (HANDSHAKECOMMAND) Descriptor() protoreflect.EnumDescriptor {
return file_worker_proxy_v1_proxy_proto_enumTypes[0].Descriptor()
}
func (HANDSHAKECOMMAND) Type() protoreflect.EnumType {
return &file_worker_proxy_v1_proxy_proto_enumTypes[0]
}
func (x HANDSHAKECOMMAND) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use HANDSHAKECOMMAND.Descriptor instead.
func (HANDSHAKECOMMAND) EnumDescriptor() ([]byte, []int) {
return file_worker_proxy_v1_proxy_proto_rawDescGZIP(), []int{0}
}
type ClientHandshake struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TofuToken string `protobuf:"bytes,10,opt,name=tofu_token,json=tofuToken,proto3" json:"tofu_token,omitempty"`
Command HANDSHAKECOMMAND `protobuf:"varint,20,opt,name=command,proto3,enum=worker.proxy.v1.HANDSHAKECOMMAND" json:"command,omitempty"`
}
func (x *ClientHandshake) Reset() {
*x = ClientHandshake{}
if protoimpl.UnsafeEnabled {
mi := &file_worker_proxy_v1_proxy_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClientHandshake) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClientHandshake) ProtoMessage() {}
func (x *ClientHandshake) ProtoReflect() protoreflect.Message {
mi := &file_worker_proxy_v1_proxy_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ClientHandshake.ProtoReflect.Descriptor instead.
func (*ClientHandshake) Descriptor() ([]byte, []int) {
return file_worker_proxy_v1_proxy_proto_rawDescGZIP(), []int{0}
}
func (x *ClientHandshake) GetTofuToken() string {
if x != nil {
return x.TofuToken
}
return ""
}
func (x *ClientHandshake) GetCommand() HANDSHAKECOMMAND {
if x != nil {
return x.Command
}
return HANDSHAKECOMMAND_HANDSHAKECOMMAND_UNSPECIFIED
}
type HandshakeResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Expiration *timestamp.Timestamp `protobuf:"bytes,10,opt,name=expiration,proto3" json:"expiration,omitempty"`
ConnectionLimit int32 `protobuf:"varint,20,opt,name=connection_limit,json=connectionLimit,proto3" json:"connection_limit,omitempty"`
ConnectionsLeft int32 `protobuf:"varint,30,opt,name=connections_left,json=connectionsLeft,proto3" json:"connections_left,omitempty"`
}
func (x *HandshakeResult) Reset() {
*x = HandshakeResult{}
if protoimpl.UnsafeEnabled {
mi := &file_worker_proxy_v1_proxy_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HandshakeResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HandshakeResult) ProtoMessage() {}
func (x *HandshakeResult) ProtoReflect() protoreflect.Message {
mi := &file_worker_proxy_v1_proxy_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HandshakeResult.ProtoReflect.Descriptor instead.
func (*HandshakeResult) Descriptor() ([]byte, []int) {
return file_worker_proxy_v1_proxy_proto_rawDescGZIP(), []int{1}
}
func (x *HandshakeResult) GetExpiration() *timestamp.Timestamp {
if x != nil {
return x.Expiration
}
return nil
}
func (x *HandshakeResult) GetConnectionLimit() int32 {
if x != nil {
return x.ConnectionLimit
}
return 0
}
func (x *HandshakeResult) GetConnectionsLeft() int32 {
if x != nil {
return x.ConnectionsLeft
}
return 0
}
var File_worker_proxy_v1_proxy_proto protoreflect.FileDescriptor
var file_worker_proxy_v1_proxy_proto_rawDesc = []byte{
0x0a, 0x1b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x76,
0x31, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x77,
0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x31, 0x1a, 0x1f,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x6d, 0x0a, 0x0f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61,
0x6b, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x66, 0x75, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x66, 0x75, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x12, 0x3b, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x14, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x21, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x41, 0x4e, 0x44, 0x53, 0x48, 0x41, 0x4b, 0x45, 0x43, 0x4f,
0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0xa3,
0x01, 0x0a, 0x0f, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x12, 0x3a, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
0x6d, 0x70, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29,
0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d,
0x69, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e,
0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x18, 0x1e, 0x20,
0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x4c, 0x65, 0x66, 0x74, 0x2a, 0x59, 0x0a, 0x10, 0x48, 0x41, 0x4e, 0x44, 0x53, 0x48, 0x41, 0x4b,
0x45, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x12, 0x20, 0x0a, 0x1c, 0x48, 0x41, 0x4e, 0x44,
0x53, 0x48, 0x41, 0x4b, 0x45, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x55, 0x4e, 0x53,
0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x48, 0x41,
0x4e, 0x44, 0x53, 0x48, 0x41, 0x4b, 0x45, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x53,
0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x01, 0x42,
0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61,
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79,
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x3b,
0x70, 0x72, 0x6f, 0x78, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_worker_proxy_v1_proxy_proto_rawDescOnce sync.Once
file_worker_proxy_v1_proxy_proto_rawDescData = file_worker_proxy_v1_proxy_proto_rawDesc
)
func file_worker_proxy_v1_proxy_proto_rawDescGZIP() []byte {
file_worker_proxy_v1_proxy_proto_rawDescOnce.Do(func() {
file_worker_proxy_v1_proxy_proto_rawDescData = protoimpl.X.CompressGZIP(file_worker_proxy_v1_proxy_proto_rawDescData)
})
return file_worker_proxy_v1_proxy_proto_rawDescData
}
var file_worker_proxy_v1_proxy_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_worker_proxy_v1_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_worker_proxy_v1_proxy_proto_goTypes = []interface{}{
(HANDSHAKECOMMAND)(0), // 0: worker.proxy.v1.HANDSHAKECOMMAND
(*ClientHandshake)(nil), // 1: worker.proxy.v1.ClientHandshake
(*HandshakeResult)(nil), // 2: worker.proxy.v1.HandshakeResult
(*timestamp.Timestamp)(nil), // 3: google.protobuf.Timestamp
}
var file_worker_proxy_v1_proxy_proto_depIdxs = []int32{
0, // 0: worker.proxy.v1.ClientHandshake.command:type_name -> worker.proxy.v1.HANDSHAKECOMMAND
3, // 1: worker.proxy.v1.HandshakeResult.expiration:type_name -> google.protobuf.Timestamp
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_worker_proxy_v1_proxy_proto_init() }
func file_worker_proxy_v1_proxy_proto_init() {
if File_worker_proxy_v1_proxy_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_worker_proxy_v1_proxy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientHandshake); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_worker_proxy_v1_proxy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HandshakeResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_worker_proxy_v1_proxy_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_worker_proxy_v1_proxy_proto_goTypes,
DependencyIndexes: file_worker_proxy_v1_proxy_proto_depIdxs,
EnumInfos: file_worker_proxy_v1_proxy_proto_enumTypes,
MessageInfos: file_worker_proxy_v1_proxy_proto_msgTypes,
}.Build()
File_worker_proxy_v1_proxy_proto = out.File
file_worker_proxy_v1_proxy_proto_rawDesc = nil
file_worker_proxy_v1_proxy_proto_goTypes = nil
file_worker_proxy_v1_proxy_proto_depIdxs = nil
}