diff --git a/app/operator/proxy.go b/app/operator/proxy.go index 1de889e..0d2fdf4 100644 --- a/app/operator/proxy.go +++ b/app/operator/proxy.go @@ -14,6 +14,7 @@ func (oper *Operator) ListForwarders(ctx context.Context, params *mlbctl.ListFor } for _, forw := range oper.proxy.Forwarders { oForw := &mlbctl.Forwarder{ + Type: forw.Type, Lport: forw.Lport, Dport: forw.Dport, Destinations: make([]*mlbctl.Destination, 0), @@ -32,7 +33,7 @@ func (oper *Operator) ListForwarders(ctx context.Context, params *mlbctl.ListFor func (oper *Operator) CreateForwarder(ctx context.Context, params *mlbctl.CreateForwarderParams) (*mlbctl.CreateForwarderResult, error) { var err error res := &mlbctl.CreateForwarderResult{} - err = oper.proxy.AddForwarder(ctx, params.Lport, params.Dport, params.Destinations...) + err = oper.proxy.AddForwarder(ctx, params.Type, params.Lport, params.Dport, params.Destinations...) if err != err { return res, err } diff --git a/app/rproxy/forwarder.go b/app/rproxy/forwarder.go index 669baf5..79ec7ba 100644 --- a/app/rproxy/forwarder.go +++ b/app/rproxy/forwarder.go @@ -11,7 +11,13 @@ import ( "helmet/app/logger" ) +const ( + TCP = "tcp" + UDP = "udp" +) + type Forwarder struct { + Type string `json:"type" yaml:"type"` listen net.Listener `json:"-" yaml:"-"` ctx context.Context `json:"-" yaml:"-"` cancel context.CancelFunc `json:"-" yaml:"-"` @@ -21,7 +27,7 @@ type Forwarder struct { log *logger.Logger } -func NewForwarder(ctx context.Context, lport, dport uint32, addrs ...string) (*Forwarder, error) { +func NewForwarder(ctx context.Context, typ string, lport, dport uint32, addrs ...string) (*Forwarder, error) { ctx, cancel := context.WithCancel(context.Background()) forw := &Forwarder{ Dests: make([]*Destination, 0), @@ -29,6 +35,7 @@ func NewForwarder(ctx context.Context, lport, dport uint32, addrs ...string) (*F Dport: dport, ctx: ctx, cancel: cancel, + Type: typ, } id := strconv.FormatUint(uint64(lport), 10) forw.log = logger.NewLogger("forwarder:" + id) @@ -50,7 +57,7 @@ func NewForwarder(ctx context.Context, lport, dport uint32, addrs ...string) (*F return forw, err } -func (forw *Forwarder) Listen(wg *sync.WaitGroup) { +func (forw *Forwarder) ListenTCP(wg *sync.WaitGroup) { forw.log.Debugf("Start listening on %d", forw.Lport) defer wg.Done() for { diff --git a/app/rproxy/rproxy.go b/app/rproxy/rproxy.go index 861b1e2..a7f547b 100644 --- a/app/rproxy/rproxy.go +++ b/app/rproxy/rproxy.go @@ -27,7 +27,7 @@ func NewProxy() *Proxy { } } -func (bal *Proxy) AddForwarder(ctx context.Context, lport, dport uint32, addrs ...string) error { +func (bal *Proxy) AddForwarder(ctx context.Context, typ string, lport, dport uint32, addrs ...string) error { var err error if lport == 0 { return errors.New("Zero lport") @@ -35,13 +35,13 @@ func (bal *Proxy) AddForwarder(ctx context.Context, lport, dport uint32, addrs . if dport == 0 { return errors.New("Zero dport") } - forw, err := NewForwarder(ctx, lport, dport, addrs...) + forw, err := NewForwarder(ctx, typ, lport, dport, addrs...) if err != nil { return err } bal.Forwarders = append(bal.Forwarders, forw) bal.wg.Add(1) - go forw.Listen(&bal.wg) + go forw.ListenTCP(&bal.wg) return err } @@ -78,7 +78,7 @@ func (bal *Proxy) Start() error { var err error for _, forw := range bal.Forwarders { bal.wg.Add(1) - go forw.Listen(&bal.wg) + go forw.ListenTCP(&bal.wg) } bal.wg.Wait() return err diff --git a/cmd/minilbctl/forwarder/createforw.go b/cmd/minilbctl/forwarder/createforw.go index 9101f81..a62b2e1 100644 --- a/cmd/minilbctl/forwarder/createforw.go +++ b/cmd/minilbctl/forwarder/createforw.go @@ -12,6 +12,7 @@ import ( type CreateForwarderParams struct { Hostname string + Type string Lport uint32 Dport uint32 Addresses []string @@ -39,6 +40,7 @@ func (tool *Tool) createForwarder(params *CreateForwarderParams) (*CreateForward defer conn.Close() ctx, _ := context.WithTimeout(context.Background(), 1*time.Second) opReq := &mlbctl.CreateForwarderParams{ + Type: params.Type, Lport: params.Lport, Dport: params.Dport, Destinations: params.Addresses, diff --git a/cmd/minilbctl/forwarder/deleteforw.go b/cmd/minilbctl/forwarder/deleteforw.go index 51e1188..6133014 100644 --- a/cmd/minilbctl/forwarder/deleteforw.go +++ b/cmd/minilbctl/forwarder/deleteforw.go @@ -12,6 +12,7 @@ import ( type DeleteForwarderParams struct { Hostname string + Type string Lport uint32 } type DeleteForwarderResult struct{} @@ -37,6 +38,7 @@ func (tool *Tool) deleteForwarder(params *DeleteForwarderParams) (*DeleteForward defer conn.Close() ctx, _ := context.WithTimeout(context.Background(), 1*time.Second) opReq := &mlbctl.DeleteForwarderParams{ + Type: params.Type, Lport: params.Lport, } _, err = cli.DeleteForwarder(ctx, opReq) diff --git a/cmd/minilbctl/forwarder/forwcmd.go b/cmd/minilbctl/forwarder/forwcmd.go index 47c8c59..7fc6566 100644 --- a/cmd/minilbctl/forwarder/forwcmd.go +++ b/cmd/minilbctl/forwarder/forwcmd.go @@ -35,9 +35,11 @@ func NewTool() *Tool { Short: "Create forwarder", Run: tool.CreateForwarder, } + createForwarderCmd.Flags().StringVarP(&tool.createForwarderParams.Type, "type", "T", "tcp", "Type of forwarding: tcp") createForwarderCmd.Flags().Uint32VarP(&tool.createForwarderParams.Lport, "lport", "L", 0, "Listening port") createForwarderCmd.Flags().Uint32VarP(&tool.createForwarderParams.Dport, "dport", "D", 0, "Destination port") createForwarderCmd.Flags().StringArrayVarP(&tool.createForwarderParams.Addresses, "dests", "A", []string{}, "Destination address list") + createForwarderCmd.MarkFlagRequired("type") createForwarderCmd.MarkFlagRequired("lport") createForwarderCmd.MarkFlagRequired("dport") createForwarderCmd.MarkFlagRequired("dests") @@ -49,8 +51,10 @@ func NewTool() *Tool { Short: "Delete forwarder", Run: tool.DeleteForwarder, } + deleteForwarderCmd.Flags().StringVarP(&tool.deleteForwarderParams.Type, "type", "T", "tcp", "Forwarder type: tcp") deleteForwarderCmd.Flags().Uint32VarP(&tool.deleteForwarderParams.Lport, "lport", "L", 0, "Listening port") deleteForwarderCmd.MarkFlagRequired("lport") + deleteForwarderCmd.MarkFlagRequired("type") tool.cmd.AddCommand(deleteForwarderCmd) return tool diff --git a/pkg/mlbctl/mlbctl.pb.go b/pkg/mlbctl/mlbctl.pb.go index cc94534..4b48b0b 100644 --- a/pkg/mlbctl/mlbctl.pb.go +++ b/pkg/mlbctl/mlbctl.pb.go @@ -103,9 +103,10 @@ func (x *GetHelloResult) GetMessage() string { type Forwarder struct { state protoimpl.MessageState `protogen:"open.v1"` - Lport uint32 `protobuf:"varint,1,opt,name=lport,proto3" json:"lport,omitempty"` - Dport uint32 `protobuf:"varint,2,opt,name=dport,proto3" json:"dport,omitempty"` - Destinations []*Destination `protobuf:"bytes,3,rep,name=destinations,proto3" json:"destinations,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Lport uint32 `protobuf:"varint,2,opt,name=lport,proto3" json:"lport,omitempty"` + Dport uint32 `protobuf:"varint,3,opt,name=dport,proto3" json:"dport,omitempty"` + Destinations []*Destination `protobuf:"bytes,4,rep,name=destinations,proto3" json:"destinations,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -140,6 +141,13 @@ func (*Forwarder) Descriptor() ([]byte, []int) { return file_mlbctl_proto_rawDescGZIP(), []int{2} } +func (x *Forwarder) GetType() string { + if x != nil { + return x.Type + } + return "" +} + func (x *Forwarder) GetLport() uint32 { if x != nil { return x.Lport @@ -287,9 +295,10 @@ func (x *ListForwardersResult) GetForwarders() []*Forwarder { type CreateForwarderParams struct { state protoimpl.MessageState `protogen:"open.v1"` - Lport uint32 `protobuf:"varint,1,opt,name=lport,proto3" json:"lport,omitempty"` - Dport uint32 `protobuf:"varint,2,opt,name=dport,proto3" json:"dport,omitempty"` - Destinations []string `protobuf:"bytes,3,rep,name=destinations,proto3" json:"destinations,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Lport uint32 `protobuf:"varint,2,opt,name=lport,proto3" json:"lport,omitempty"` + Dport uint32 `protobuf:"varint,3,opt,name=dport,proto3" json:"dport,omitempty"` + Destinations []string `protobuf:"bytes,4,rep,name=destinations,proto3" json:"destinations,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -324,6 +333,13 @@ func (*CreateForwarderParams) Descriptor() ([]byte, []int) { return file_mlbctl_proto_rawDescGZIP(), []int{6} } +func (x *CreateForwarderParams) GetType() string { + if x != nil { + return x.Type + } + return "" +} + func (x *CreateForwarderParams) GetLport() uint32 { if x != nil { return x.Lport @@ -383,7 +399,8 @@ func (*CreateForwarderResult) Descriptor() ([]byte, []int) { type DeleteForwarderParams struct { state protoimpl.MessageState `protogen:"open.v1"` - Lport uint32 `protobuf:"varint,1,opt,name=lport,proto3" json:"lport,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Lport uint32 `protobuf:"varint,2,opt,name=lport,proto3" json:"lport,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -418,6 +435,13 @@ func (*DeleteForwarderParams) Descriptor() ([]byte, []int) { return file_mlbctl_proto_rawDescGZIP(), []int{8} } +func (x *DeleteForwarderParams) GetType() string { + if x != nil { + return x.Type + } + return "" +} + func (x *DeleteForwarderParams) GetLport() uint32 { if x != nil { return x.Lport @@ -469,56 +493,60 @@ var file_mlbctl_proto_rawDesc = string([]byte{ 0x6c, 0x6f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x67, 0x65, 0x74, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x22, 0x70, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, - 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x37, 0x0a, - 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x64, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, - 0x16, 0x0a, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, - 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x49, 0x0a, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x46, - 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x31, 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x66, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, - 0x72, 0x73, 0x22, 0x67, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, - 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, - 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x64, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x63, + 0x73, 0x61, 0x67, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x64, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x70, 0x6f, + 0x72, 0x74, 0x12, 0x37, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, + 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x64, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, + 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x49, 0x0a, 0x14, + 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x31, 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, + 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, + 0x6c, 0x2e, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x66, 0x6f, 0x72, + 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x22, 0x7b, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, + 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, + 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x41, 0x0a, + 0x15, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, + 0x22, 0x17, 0x0a, 0x15, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, + 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xbd, 0x02, 0x0a, 0x07, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x3c, 0x0a, 0x08, 0x67, 0x65, 0x74, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x12, 0x16, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x67, 0x65, 0x74, 0x48, 0x65, + 0x6c, 0x6c, 0x6f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x6d, 0x6c, 0x62, 0x63, + 0x74, 0x6c, 0x2e, 0x67, 0x65, 0x74, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, + 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x2d, 0x0a, 0x15, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, - 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, - 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, - 0x6f, 0x72, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xbd, 0x02, 0x0a, - 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x3c, 0x0a, 0x08, 0x67, 0x65, 0x74, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x16, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x67, 0x65, - 0x74, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x6d, - 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x67, 0x65, 0x74, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0e, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, + 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, + 0x6c, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1c, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, + 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x6d, 0x6c, 0x62, 0x63, - 0x74, 0x6c, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, + 0x74, 0x6c, 0x2e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, - 0x6c, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0e, 0x6c, 0x69, 0x73, - 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x6c, - 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1c, 0x2e, 0x6d, 0x6c, 0x62, 0x63, - 0x74, 0x6c, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0f, 0x64, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x6d, - 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, - 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x6d, 0x6c, - 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, - 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, - 0x2e, 0x3b, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x2e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x3b, 0x6d, + 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, }) var ( diff --git a/proto/mlbctl.proto b/proto/mlbctl.proto index bc2503b..cb591e7 100644 --- a/proto/mlbctl.proto +++ b/proto/mlbctl.proto @@ -17,9 +17,10 @@ message getHelloResult { } message forwarder { - uint32 lport = 1; - uint32 dport = 2; - repeated destination destinations = 3; + string type = 1; + uint32 lport = 2; + uint32 dport = 3; + repeated destination destinations = 4; } message destination { @@ -32,13 +33,15 @@ message listForwardersResult { } message createForwarderParams { - uint32 lport = 1; - uint32 dport = 2; - repeated string destinations = 3; + string type = 1; + uint32 lport = 2; + uint32 dport = 3; + repeated string destinations = 4; } message createForwarderResult {} message deleteForwarderParams { - uint32 lport = 1; + string type = 1; + uint32 lport = 2; } message deleteForwarderResult {}