From 1d9a7df5d40410f66ee5d51076fc9fa5d0af968e Mon Sep 17 00:00:00 2001 From: Mark Anderson Date: Fri, 26 Mar 2021 12:43:57 -0700 Subject: [PATCH] First changes for unix domain sockets upstreams Start making structure changes to support unix domain socket address for upstreams upstreams = [ { destination_name = "echo-service" local_bind_socket_path = "/tmp/upstream.sock" config { passive_health_check { interval = "10s" max_failures = 42 } } } Signed-off-by: Mark Anderson --- agent/config/builder.go | 2 + agent/config/config.go | 9 +- agent/structs/connect_proxy_config.go | 40 ++++- agent/structs/structs.go | 5 +- api/agent.go | 2 + proto/pbservice/service.pb.go | 235 ++++++++++++++++++-------- proto/pbservice/service.proto | 4 + 7 files changed, 221 insertions(+), 76 deletions(-) diff --git a/agent/config/builder.go b/agent/config/builder.go index dd9347834..d80d771a8 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -1706,6 +1706,8 @@ func (b *builder) upstreamsVal(v []Upstream) structs.Upstreams { Datacenter: stringVal(u.Datacenter), LocalBindAddress: stringVal(u.LocalBindAddress), LocalBindPort: intVal(u.LocalBindPort), + LocalBindSocketPath: stringVal(u.LocalBindSocketPath), + LocalBindSocketMode: uint32Val(u.LocalBindSocketMode), Config: u.Config, MeshGateway: b.meshGatewayConfVal(u.MeshGateway), } diff --git a/agent/config/config.go b/agent/config/config.go index b65cb5280..bfff0e445 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -503,14 +503,21 @@ type Upstream struct { // datacenter. Datacenter *string `mapstructure:"datacenter"` + // It would be worth thinking about a separate structure for these four items, + // unifying under address as something like "unix:/tmp/foo", "tcp:localhost:80" could make sense // LocalBindAddress is the ip address a side-car proxy should listen on for - // traffic destined for this upstream service. Default if empty is 127.0.0.1. + // traffic destined for this upstream service. Default if empty and local bind socket + // is not present is 127.0.0.1. LocalBindAddress *string `mapstructure:"local_bind_address"` // LocalBindPort is the ip address a side-car proxy should listen on for traffic // destined for this upstream service. Required. LocalBindPort *int `mapstructure:"local_bind_port"` + // These are exclusive with LocalBindAddress/LocalBindPort + LocalBindSocketPath *string `mapstructure:"local_bind_socket_path"` + LocalBindSocketMode *uint32 `mapstructure:"local_bind_socket_mode"` + // Config is an opaque config that is specific to the proxy process being run. // It can be used to pass arbitrary configuration for this specific upstream // to the proxy. diff --git a/agent/structs/connect_proxy_config.go b/agent/structs/connect_proxy_config.go index eff98a0d7..eb257c9e4 100644 --- a/agent/structs/connect_proxy_config.go +++ b/agent/structs/connect_proxy_config.go @@ -3,6 +3,7 @@ package structs import ( "encoding/json" "fmt" + "net" "github.com/hashicorp/consul/api" "github.com/hashicorp/consul/lib" @@ -319,7 +320,11 @@ type Upstream struct { // LocalBindPort is the ip address a side-car proxy should listen on for traffic // destined for this upstream service. Required. - LocalBindPort int `alias:"local_bind_port"` + LocalBindPort int `json:",omitempty" alias:"local_bind_port"` + + // These are exclusive with LocalBindAddress/LocalBindPort + LocalBindSocketPath string `json:",omitempty" alias:"local_bind_socket_path"` + LocalBindSocketMode uint32 `json:",omitempty" alias:"local_bind_socket_mode"` // Config is an opaque config that is specific to the proxy process being run. // It can be used to pass arbitrary configuration for this specific upstream @@ -349,6 +354,9 @@ func (t *Upstream) UnmarshalJSON(data []byte) (err error) { LocalBindAddressSnake string `json:"local_bind_address"` LocalBindPortSnake int `json:"local_bind_port"` + LocalBindSocketPathSnake string `json:"local_bind_socket_path"` + LocalBindSocketModeSnake uint32 `json:"local_bind_socket_mode"` + MeshGatewaySnake MeshGatewayConfig `json:"mesh_gateway"` *Alias @@ -373,6 +381,12 @@ func (t *Upstream) UnmarshalJSON(data []byte) (err error) { if t.LocalBindPort == 0 { t.LocalBindPort = aux.LocalBindPortSnake } + if t.LocalBindSocketPath == "" { + t.LocalBindSocketPath = aux.LocalBindSocketPathSnake + } + if t.LocalBindSocketMode == 0 { + t.LocalBindSocketMode = aux.LocalBindSocketModeSnake + } if t.MeshGateway.Mode == "" { t.MeshGateway.Mode = aux.MeshGatewaySnake.Mode } @@ -415,6 +429,8 @@ func (u *Upstream) ToAPI() api.Upstream { Datacenter: u.Datacenter, LocalBindAddress: u.LocalBindAddress, LocalBindPort: u.LocalBindPort, + LocalBindSocketPath: u.LocalBindSocketPath, + LocalBindSocketMode: u.LocalBindSocketMode, Config: u.Config, MeshGateway: u.MeshGateway.ToAPI(), } @@ -435,6 +451,26 @@ func (u *Upstream) ToKey() UpstreamKey { } } +func (u Upstream) HasLocalPortOrSocket() bool { + return (u.LocalBindPort != 0 || u.LocalBindSocketPath != "") +} + +func (u Upstream) UpstreamIsUnixSocket() bool { + return (u.LocalBindPort == 0 && u.LocalBindAddress == "" && u.LocalBindSocketPath != "") +} + +func (u Upstream) UpstreamAddressToString() string { + if u.UpstreamIsUnixSocket() { + return u.LocalBindSocketPath + } + + addr := u.LocalBindAddress + if addr == "" { + addr = "127.0.0.1" + } + return net.JoinHostPort(addr, fmt.Sprintf("%d", u.LocalBindPort)) +} + type UpstreamKey struct { DestinationType string DestinationName string @@ -466,6 +502,8 @@ func UpstreamFromAPI(u api.Upstream) Upstream { Datacenter: u.Datacenter, LocalBindAddress: u.LocalBindAddress, LocalBindPort: u.LocalBindPort, + LocalBindSocketPath: u.LocalBindSocketPath, + LocalBindSocketMode: u.LocalBindSocketMode, Config: u.Config, } } diff --git a/agent/structs/structs.go b/agent/structs/structs.go index 7be5e5c1a..e14eab569 100644 --- a/agent/structs/structs.go +++ b/agent/structs/structs.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "math/rand" - "net" "reflect" "regexp" "sort" @@ -811,7 +810,7 @@ type Services map[string][]string type ServiceNode struct { ID types.NodeID Node string - Address string + Address string // TODO markan; this is slippery when we have sockets; the addr:path pattern falls apart. Datacenter string TaggedAddresses map[string]string NodeMeta map[string]string @@ -974,11 +973,13 @@ const ( ) // Type to hold a address and port of a service +// TODO markan, think about this around sockets type ServiceAddress struct { Address string Port int } +// TODO markan, think about this around sockets func (a ServiceAddress) ToAPIServiceAddress() api.ServiceAddress { return api.ServiceAddress{Address: a.Address, Port: a.Port} } diff --git a/api/agent.go b/api/agent.go index c21ef2016..6263972ca 100644 --- a/api/agent.go +++ b/api/agent.go @@ -407,6 +407,8 @@ type Upstream struct { Datacenter string `json:",omitempty"` LocalBindAddress string `json:",omitempty"` LocalBindPort int `json:",omitempty"` + LocalBindSocketPath string `json:",omitempty"` + LocalBindSocketMode uint32 `json:",omitempty"` Config map[string]interface{} `json:",omitempty" bexpr:"-"` MeshGateway MeshGatewayConfig `json:",omitempty"` CentrallyConfigured bool `json:",omitempty" bexpr:"-"` diff --git a/proto/pbservice/service.pb.go b/proto/pbservice/service.pb.go index 1f0611b7b..801495f9e 100644 --- a/proto/pbservice/service.pb.go +++ b/proto/pbservice/service.pb.go @@ -154,6 +154,9 @@ type Upstream struct { // CentrallyConfigured indicates whether the upstream was defined in a proxy // instance registration or whether it was generated from a config entry. CentrallyConfigured bool `protobuf:"varint,9,opt,name=CentrallyConfigured,proto3" json:"CentrallyConfigured,omitempty"` + // LocalBindSocketPath is the socket to create to connect to the upstream service + LocalBindSocketPath string `protobuf:"bytes,10,opt,name=LocalBindSocketPath,proto3" json:"LocalBindSocketPath,omitempty"` + LocalBindSocketMode string `protobuf:"bytes,11,opt,name=LocalBindSocketMode,proto3" json:"LocalBindSocketMode,omitempty"` } func (m *Upstream) Reset() { *m = Upstream{} } @@ -608,78 +611,80 @@ func init() { func init() { proto.RegisterFile("proto/pbservice/service.proto", fileDescriptor_cbb99233b75fb80b) } var fileDescriptor_cbb99233b75fb80b = []byte{ - // 1135 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xfa, 0x4f, 0x6c, 0xbf, 0x94, 0x34, 0x99, 0x9a, 0xb0, 0x84, 0xd6, 0x49, 0x2d, 0x84, - 0x22, 0x88, 0xec, 0x34, 0x51, 0x09, 0xad, 0x54, 0x24, 0x12, 0x07,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0x3c, 0x46, 0x65, 0x62, 0x64, 0x13, 0xee, 0x1d, 0x08, 0x97, 0x0e, 0x8d, 0xe5, 0xab, 0x7e, 0x3f, - 0x60, 0x52, 0xda, 0x05, 0x0c, 0xc9, 0x82, 0xc8, 0xa7, 0xb0, 0x98, 0x34, 0x77, 0x44, 0xa0, 0xec, - 0xe2, 0x9a, 0xb5, 0x5e, 0x72, 0x66, 0xec, 0xe4, 0x31, 0xcc, 0x85, 0xff, 0xc9, 0x2e, 0xad, 0x59, - 0xeb, 0xf3, 0x5b, 0x1f, 0x34, 0xc3, 0x2a, 0x37, 0xa3, 0x2a, 0x37, 0x8f, 0xb0, 0xca, 0xbb, 0xc5, - 0xf3, 0x8b, 0x55, 0xcb, 0x31, 0xce, 0x64, 0x07, 0xaa, 0xdf, 0x8d, 0xa5, 0x0a, 0x18, 0x1d, 0x49, - 0x7b, 0x6e, 0xad, 0xb0, 0x3e, 0xbf, 0x75, 0xaf, 0x19, 0x97, 0xb7, 0x19, 0x61, 0x18, 0x95, 0x73, - 0x6e, 0x7c, 0x49, 0x1b, 0xe6, 0x0f, 0x99, 0x1c, 0x7c, 0x43, 0x15, 0xfb, 0x89, 0x9e, 0xd9, 0x65, - 0x3c, 0xf4, 0x7e, 0x22, 0x34, 0x81, 0x86, 0x67, 0x19, 0x8e, 0x64, 0x98, 0xce, 0x7a, 0xff, 0xcd, - 0x58, 0x48, 0x66, 0x57, 0x4c, 0xd6, 0x37, 0x04, 0x21, 0x30, 0x15, 0x6b, 0x9c, 0xc9, 0x0b, 0x28, - 0x1e, 0x8a, 0x3e, 0xb3, 0xab, 0xba, 0x76, 0xbb, 0x3b, 0xd7, 0x17, 0xab, 0xdb, 0x9e, 0xaf, 0x06, - 0x93, 0x5e, 0xd3, 0x15, 0xa3, 0xd6, 0x80, 0xca, 0x81, 0xef, 0x8a, 0x60, 0xdc, 0x72, 0x05, 0x97, - 0x93, 0x61, 0x8b, 0x7a, 0x8c, 0x2b, 0xa3, 0x32, 0xd9, 0xc4, 0xfe, 0xeb, 0x70, 0x07, 0x49, 0xc8, - 0x11, 0x2c, 0x76, 0x03, 0xca, 0xe5, 0x98, 0x06, 0x8c, 0x87, 0xea, 0xb0, 0x01, 0xb3, 0x79, 0x98, - 0xc8, 0x26, 0xed, 0x32, 0x95, 0xd7, 0x0c, 0x41, 0xe3, 0xf7, 0x02, 0x54, 0xa2, 0x62, 0x91, 0x75, - 0xb8, 0x9b, 0x50, 0x44, 0xf7, 0x6c, 0x1c, 0xc9, 0x2b, 0x6d, 0x4e, 0xe9, 0x4a, 0x4b, 0x4d, 0x8e, - 0xa9, 0xcb, 0x32, 0x74, 0x15, 0x63, 0x29, 0x76, 0x14, 0x6f, 0x61, 0x86, 0x1d, 0x55, 0x5b, 0x07, - 0x68, 0x53, 0x45, 0x5d, 0xc6, 0x15, 0x0b, 0x50, 0x49, 0x55, 0x27, 0x61, 0x89, 0xf5, 0xb6, 0xeb, - 0xf3, 0x7e, 0x24, 0xcf, 0x12, 0x7a, 0xcd, 0xd8, 0xc9, 0xc7, 0xf0, 0x5e, 0x6c, 0x43, 0x61, 0xce, - 0xa1, 0x30, 0xa7, 0x8d, 0x09, 0x55, 0x96, 0xff, 0x8b, 0x2a, 0x53, 0xe2, 0xaa, 0xfc, 0x3f, 0x71, - 0x6d, 0xc2, 0xbd, 0x3d, 0xc6, 0x55, 0x40, 0x87, 0x43, 0xe3, 0x35, 0x09, 0x58, 0x1f, 0x45, 0x53, - 0x71, 0xb2, 0xa0, 0x06, 0x87, 0x05, 0x33, 0x53, 0xe6, 0xae, 0x20, 0xcb, 0x30, 0xf7, 0x92, 0x2a, - 0xff, 0x34, 0xec, 0x58, 0xc5, 0x31, 0x3b, 0xd2, 0x86, 0x85, 0x23, 0xbf, 0xcf, 0x5c, 0x1a, 0x98, - 0x00, 0xac, 0xf9, 0x74, 0x92, 0x06, 0x69, 0xb3, 0x63, 0x9f, 0xfb, 0xba, 0x09, 0x4e, 0x2a, 0xa6, - 0xf1,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 0x0b, 0xbc, 0x84, - 0xd1, 0xcb, 0x4d, 0xf3, 0xa9, 0x34, 0x8d, 0x9a, 0x8a, 0xa4, 0x62, 0xc8, 0x36, 0x94, 0xcd, 0x11, - 0xf6, 0x5d, 0x0c, 0xff, 0x70, 0xb6, 0x3f, 0xc6, 0xc1, 0x89, 0x3c, 0x57, 0x7e, 0x84, 0x5a, 0x96, - 0x00, 0xc8, 0x22, 0x14, 0x4e, 0xd8, 0x99, 0x79, 0xd4, 0xf4, 0x92, 0xb4, 0xa0, 0x74, 0x4a, 0x87, - 0x93, 0xf0, 0xe5, 0xca, 0x24, 0x37, 0x14, 0x4e, 0xe8, 0xf7, 0x34, 0xff, 0x85, 0xb5, 0xb2, 0x03, - 0xd5, 0x58, 0x07, 0x19, 0x9c, 0xb5, 0x24, 0x67, 0x35, 0x11, 0xd8, 0xf8, 0x32, 0xbe, 0xb7, 0x23, - 0x79, 0x27, 0x84, 0x6f, 0x4d, 0x0b, 0x3f, 0x52, 0x56, 0xfe, 0x46, 0x59, 0x8d, 0x67, 0x71, 0xe7, - 0x75, 0x60, 0x87, 0x4a, 0xe9, 0x73, 0xcf, 0x4c, 0x7d, 0xb4, 0xd5, 0xc8, 0x6b, 0x1a, 0x70, 0x8d, - 0x84, 0xb1, 0xd1, 0x76, 0xf7, 0xf0, 0xfc, 0xaf, 0x7a, 0xee, 0xfc, 0xb2, 0x6e, 0xbd, 0xbd, 0xac, - 0x5b, 0x7f, 0x5e, 0xd6, 0xad, 0x5f, 0xae, 0xea, 0xb9, 0x5f, 0xaf, 0xea, 0xb9, 0xb7, 0x57, 0xf5, - 0xdc, 0x1f, 0x57, 0xf5, 0xdc, 0x0f, 0x9f, 0xdd, 0x36, 0xfc, 0xa9, 0x6f, 0xda, 0xde, 0x1c, 0x1a, - 0xb6, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xf1, 0x41, 0x33, 0x52, 0x0b, 0x00, 0x00, + // 1161 bytes of a gzipped FileDescript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0xa4, 0xb8, 0x45, 0xf5, 0xfe, 0x8f, 0x84, 0x7b, 0xc2, 0x54, 0x87, 0xaa, 0x01, 0xd2, + 0x10, 0xb5, 0xe8, 0xb4, 0x94, 0x11, 0x81, 0x60, 0xce, 0x67, 0x46, 0x68, 0xa9, 0xc1, 0x61, 0xc1, + 0xf4, 0xad, 0x99, 0x47, 0x64, 0x19, 0xe6, 0x5e, 0x52, 0xe5, 0x9f, 0x86, 0x54, 0x54, 0x1c, 0xb3, + 0x22, 0x6d, 0x58, 0x38, 0xf2, 0xfb, 0xcc, 0xa5, 0x81, 0x09, 0xc0, 0x73, 0x9d, 0x2e, 0x84, 0x51, + 0xda, 0xec, 0xd8, 0xe7, 0xbe, 0x3e, 0x68, 0x27, 0x15, 0xd3, 0xf8, 0x1e, 0xee, 0x24, 0x3b, 0x49, + 0xbf, 0x6d, 0x4f, 0x8f, 0x4b, 0x19, 0xbd, 0x2d, 0x5c, 0x91, 0x47, 0x50, 0xd2, 0xff, 0x48, 0xda, + 0x79, 0x9c, 0x02, 0xef, 0xcf, 0x74, 0xa2, 0x56, 0x4d, 0x99, 0x43, 0xcf, 0xc6, 0xef, 0x16, 0xc0, + 0x8d, 0x46, 0x1a, 0x70, 0xe7, 0xc0, 0x97, 0x8a, 0x71, 0x16, 0x20, 0x11, 0x16, 0x12, 0x31, 0x65, + 0x23, 0x04, 0x8a, 0x58, 0xd2, 0x10, 0x68, 0x7c, 0x8e, 0x51, 0xd2, 0x0b, 0x0c, 0x2c, 0x24, 0x50, + 0x8a, 0x8c, 0x64, 0x05, 0x2a, 0x1d, 0x0d, 0x8d, 0x2b, 0x86, 0x06, 0xdd, 0x78, 0xad, 0x5b, 0xa0, + 0x43, 0x03, 0xc9, 0xfa, 0x5f, 0x07, 0x62, 0x84, 0xff, 0x07, 0xb9, 0xad, 0x38, 0x69, 0x73, 0xe3, + 0x18, 0x96, 0x66, 0xd8, 0x21, 0xdf, 0x9a, 0x71, 0x82, 0x4d, 0xb9, 0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, 0x95, 0x30, 0x36, 0x5a, 0xee, 0x1e, 0x9e, + 0xff, 0x55, 0xcf, 0x9d, 0x5f, 0xd6, 0xad, 0xb7, 0x97, 0x75, 0xeb, 0xcf, 0xcb, 0xba, 0xf5, 0xcb, + 0x55, 0x3d, 0xf7, 0xdb, 0x55, 0x3d, 0xf7, 0xf6, 0xaa, 0x9e, 0xfb, 0xe3, 0xaa, 0x9e, 0xfb, 0xe1, + 0xb3, 0xdb, 0x9a, 0x3f, 0xf5, 0xdd, 0xdc, 0x9b, 0x43, 0xc3, 0xf6, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x0f, 0xd3, 0xfd, 0x57, 0xb6, 0x0b, 0x00, 0x00, } func (m *ConnectProxyConfig) Marshal() (dAtA []byte, err error) { @@ -814,6 +819,20 @@ func (m *Upstream) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.LocalBindSocketMode) > 0 { + i -= len(m.LocalBindSocketMode) + copy(dAtA[i:], m.LocalBindSocketMode) + i = encodeVarintService(dAtA, i, uint64(len(m.LocalBindSocketMode))) + i-- + dAtA[i] = 0x5a + } + if len(m.LocalBindSocketPath) > 0 { + i -= len(m.LocalBindSocketPath) + copy(dAtA[i:], m.LocalBindSocketPath) + i = encodeVarintService(dAtA, i, uint64(len(m.LocalBindSocketPath))) + i-- + dAtA[i] = 0x52 + } if m.CentrallyConfigured { i-- if m.CentrallyConfigured { @@ -1456,6 +1475,14 @@ func (m *Upstream) Size() (n int) { if m.CentrallyConfigured { n += 2 } + l = len(m.LocalBindSocketPath) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.LocalBindSocketMode) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } return n } @@ -2327,6 +2354,70 @@ func (m *Upstream) Unmarshal(dAtA []byte) error { } } m.CentrallyConfigured = bool(v != 0) + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalBindSocketPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalBindSocketPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalBindSocketMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalBindSocketMode = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/proto/pbservice/service.proto b/proto/pbservice/service.proto index 60f4d26da..16aa9e323 100644 --- a/proto/pbservice/service.proto +++ b/proto/pbservice/service.proto @@ -127,6 +127,10 @@ message Upstream { // CentrallyConfigured indicates whether the upstream was defined in a proxy // instance registration or whether it was generated from a config entry. bool CentrallyConfigured = 9; + + // LocalBindSocketPath is the socket to create to connect to the upstream service + string LocalBindSocketPath = 10; + string LocalBindSocketMode = 11; } // ServiceConnect are the shared Connect settings between all service