added initial typing of forwarders, now only tcp

This commit is contained in:
2026-03-26 17:17:18 +02:00
parent e05d610882
commit 230022f856
8 changed files with 115 additions and 68 deletions

View File

@@ -14,6 +14,7 @@ func (oper *Operator) ListForwarders(ctx context.Context, params *mlbctl.ListFor
} }
for _, forw := range oper.proxy.Forwarders { for _, forw := range oper.proxy.Forwarders {
oForw := &mlbctl.Forwarder{ oForw := &mlbctl.Forwarder{
Type: forw.Type,
Lport: forw.Lport, Lport: forw.Lport,
Dport: forw.Dport, Dport: forw.Dport,
Destinations: make([]*mlbctl.Destination, 0), 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) { func (oper *Operator) CreateForwarder(ctx context.Context, params *mlbctl.CreateForwarderParams) (*mlbctl.CreateForwarderResult, error) {
var err error var err error
res := &mlbctl.CreateForwarderResult{} 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 { if err != err {
return res, err return res, err
} }

View File

@@ -11,7 +11,13 @@ import (
"helmet/app/logger" "helmet/app/logger"
) )
const (
TCP = "tcp"
UDP = "udp"
)
type Forwarder struct { type Forwarder struct {
Type string `json:"type" yaml:"type"`
listen net.Listener `json:"-" yaml:"-"` listen net.Listener `json:"-" yaml:"-"`
ctx context.Context `json:"-" yaml:"-"` ctx context.Context `json:"-" yaml:"-"`
cancel context.CancelFunc `json:"-" yaml:"-"` cancel context.CancelFunc `json:"-" yaml:"-"`
@@ -21,7 +27,7 @@ type Forwarder struct {
log *logger.Logger 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()) ctx, cancel := context.WithCancel(context.Background())
forw := &Forwarder{ forw := &Forwarder{
Dests: make([]*Destination, 0), Dests: make([]*Destination, 0),
@@ -29,6 +35,7 @@ func NewForwarder(ctx context.Context, lport, dport uint32, addrs ...string) (*F
Dport: dport, Dport: dport,
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,
Type: typ,
} }
id := strconv.FormatUint(uint64(lport), 10) id := strconv.FormatUint(uint64(lport), 10)
forw.log = logger.NewLogger("forwarder:" + id) forw.log = logger.NewLogger("forwarder:" + id)
@@ -50,7 +57,7 @@ func NewForwarder(ctx context.Context, lport, dport uint32, addrs ...string) (*F
return forw, err 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) forw.log.Debugf("Start listening on %d", forw.Lport)
defer wg.Done() defer wg.Done()
for { for {

View File

@@ -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 var err error
if lport == 0 { if lport == 0 {
return errors.New("Zero lport") return errors.New("Zero lport")
@@ -35,13 +35,13 @@ func (bal *Proxy) AddForwarder(ctx context.Context, lport, dport uint32, addrs .
if dport == 0 { if dport == 0 {
return errors.New("Zero dport") return errors.New("Zero dport")
} }
forw, err := NewForwarder(ctx, lport, dport, addrs...) forw, err := NewForwarder(ctx, typ, lport, dport, addrs...)
if err != nil { if err != nil {
return err return err
} }
bal.Forwarders = append(bal.Forwarders, forw) bal.Forwarders = append(bal.Forwarders, forw)
bal.wg.Add(1) bal.wg.Add(1)
go forw.Listen(&bal.wg) go forw.ListenTCP(&bal.wg)
return err return err
} }
@@ -78,7 +78,7 @@ func (bal *Proxy) Start() error {
var err error var err error
for _, forw := range bal.Forwarders { for _, forw := range bal.Forwarders {
bal.wg.Add(1) bal.wg.Add(1)
go forw.Listen(&bal.wg) go forw.ListenTCP(&bal.wg)
} }
bal.wg.Wait() bal.wg.Wait()
return err return err

View File

@@ -12,6 +12,7 @@ import (
type CreateForwarderParams struct { type CreateForwarderParams struct {
Hostname string Hostname string
Type string
Lport uint32 Lport uint32
Dport uint32 Dport uint32
Addresses []string Addresses []string
@@ -39,6 +40,7 @@ func (tool *Tool) createForwarder(params *CreateForwarderParams) (*CreateForward
defer conn.Close() defer conn.Close()
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second) ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
opReq := &mlbctl.CreateForwarderParams{ opReq := &mlbctl.CreateForwarderParams{
Type: params.Type,
Lport: params.Lport, Lport: params.Lport,
Dport: params.Dport, Dport: params.Dport,
Destinations: params.Addresses, Destinations: params.Addresses,

View File

@@ -12,6 +12,7 @@ import (
type DeleteForwarderParams struct { type DeleteForwarderParams struct {
Hostname string Hostname string
Type string
Lport uint32 Lport uint32
} }
type DeleteForwarderResult struct{} type DeleteForwarderResult struct{}
@@ -37,6 +38,7 @@ func (tool *Tool) deleteForwarder(params *DeleteForwarderParams) (*DeleteForward
defer conn.Close() defer conn.Close()
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second) ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
opReq := &mlbctl.DeleteForwarderParams{ opReq := &mlbctl.DeleteForwarderParams{
Type: params.Type,
Lport: params.Lport, Lport: params.Lport,
} }
_, err = cli.DeleteForwarder(ctx, opReq) _, err = cli.DeleteForwarder(ctx, opReq)

View File

@@ -35,9 +35,11 @@ func NewTool() *Tool {
Short: "Create forwarder", Short: "Create forwarder",
Run: tool.CreateForwarder, 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.Lport, "lport", "L", 0, "Listening port")
createForwarderCmd.Flags().Uint32VarP(&tool.createForwarderParams.Dport, "dport", "D", 0, "Destination 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.Flags().StringArrayVarP(&tool.createForwarderParams.Addresses, "dests", "A", []string{}, "Destination address list")
createForwarderCmd.MarkFlagRequired("type")
createForwarderCmd.MarkFlagRequired("lport") createForwarderCmd.MarkFlagRequired("lport")
createForwarderCmd.MarkFlagRequired("dport") createForwarderCmd.MarkFlagRequired("dport")
createForwarderCmd.MarkFlagRequired("dests") createForwarderCmd.MarkFlagRequired("dests")
@@ -49,8 +51,10 @@ func NewTool() *Tool {
Short: "Delete forwarder", Short: "Delete forwarder",
Run: tool.DeleteForwarder, 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.Flags().Uint32VarP(&tool.deleteForwarderParams.Lport, "lport", "L", 0, "Listening port")
deleteForwarderCmd.MarkFlagRequired("lport") deleteForwarderCmd.MarkFlagRequired("lport")
deleteForwarderCmd.MarkFlagRequired("type")
tool.cmd.AddCommand(deleteForwarderCmd) tool.cmd.AddCommand(deleteForwarderCmd)
return tool return tool

View File

@@ -103,9 +103,10 @@ func (x *GetHelloResult) GetMessage() string {
type Forwarder struct { type Forwarder struct {
state protoimpl.MessageState `protogen:"open.v1"` 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"`
Dport uint32 `protobuf:"varint,2,opt,name=dport,proto3" json:"dport,omitempty"` Lport uint32 `protobuf:"varint,2,opt,name=lport,proto3" json:"lport,omitempty"`
Destinations []*Destination `protobuf:"bytes,3,rep,name=destinations,proto3" json:"destinations,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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -140,6 +141,13 @@ func (*Forwarder) Descriptor() ([]byte, []int) {
return file_mlbctl_proto_rawDescGZIP(), []int{2} return file_mlbctl_proto_rawDescGZIP(), []int{2}
} }
func (x *Forwarder) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Forwarder) GetLport() uint32 { func (x *Forwarder) GetLport() uint32 {
if x != nil { if x != nil {
return x.Lport return x.Lport
@@ -287,9 +295,10 @@ func (x *ListForwardersResult) GetForwarders() []*Forwarder {
type CreateForwarderParams struct { type CreateForwarderParams struct {
state protoimpl.MessageState `protogen:"open.v1"` 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"`
Dport uint32 `protobuf:"varint,2,opt,name=dport,proto3" json:"dport,omitempty"` Lport uint32 `protobuf:"varint,2,opt,name=lport,proto3" json:"lport,omitempty"`
Destinations []string `protobuf:"bytes,3,rep,name=destinations,proto3" json:"destinations,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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -324,6 +333,13 @@ func (*CreateForwarderParams) Descriptor() ([]byte, []int) {
return file_mlbctl_proto_rawDescGZIP(), []int{6} return file_mlbctl_proto_rawDescGZIP(), []int{6}
} }
func (x *CreateForwarderParams) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *CreateForwarderParams) GetLport() uint32 { func (x *CreateForwarderParams) GetLport() uint32 {
if x != nil { if x != nil {
return x.Lport return x.Lport
@@ -383,7 +399,8 @@ func (*CreateForwarderResult) Descriptor() ([]byte, []int) {
type DeleteForwarderParams struct { type DeleteForwarderParams struct {
state protoimpl.MessageState `protogen:"open.v1"` 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -418,6 +435,13 @@ func (*DeleteForwarderParams) Descriptor() ([]byte, []int) {
return file_mlbctl_proto_rawDescGZIP(), []int{8} return file_mlbctl_proto_rawDescGZIP(), []int{8}
} }
func (x *DeleteForwarderParams) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *DeleteForwarderParams) GetLport() uint32 { func (x *DeleteForwarderParams) GetLport() uint32 {
if x != nil { if x != nil {
return x.Lport 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, 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, 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, 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, 0x73, 0x61, 0x67, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64,
0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05,
0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x70, 0x6f,
0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x6c, 0x2e, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x64,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64,
0x16, 0x0a, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64,
0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x49, 0x0a, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x65, 0x73, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77,
0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x49, 0x0a, 0x14,
0x31, 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65,
0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e, 0x66, 0x6f, 0x72, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x31, 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65,
0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 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,
0x72, 0x73, 0x22, 0x67, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x6c, 0x2e, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x66, 0x6f, 0x72,
0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x22, 0x7b, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74,
0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x52, 0x05, 0x64, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20,
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x70,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x63, 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, 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, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0e, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f,
0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74,
0x05, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x70, 0x6c, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73,
0x6f, 0x72, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x6f, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1c, 0x2e, 0x6d, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x2e,
0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xbd, 0x02, 0x0a, 0x6c, 0x69, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65,
0x07, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x3c, 0x0a, 0x08, 0x67, 0x65, 0x74, 0x48, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
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, 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, 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, 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, 0x12, 0x4e, 0x0a, 0x0e, 0x6c, 0x69, 0x73, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x3b, 0x6d,
0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x6c, 0x6c, 0x62, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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,
}) })
var ( var (

View File

@@ -17,9 +17,10 @@ message getHelloResult {
} }
message forwarder { message forwarder {
uint32 lport = 1; string type = 1;
uint32 dport = 2; uint32 lport = 2;
repeated destination destinations = 3; uint32 dport = 3;
repeated destination destinations = 4;
} }
message destination { message destination {
@@ -32,13 +33,15 @@ message listForwardersResult {
} }
message createForwarderParams { message createForwarderParams {
uint32 lport = 1; string type = 1;
uint32 dport = 2; uint32 lport = 2;
repeated string destinations = 3; uint32 dport = 3;
repeated string destinations = 4;
} }
message createForwarderResult {} message createForwarderResult {}
message deleteForwarderParams { message deleteForwarderParams {
uint32 lport = 1; string type = 1;
uint32 lport = 2;
} }
message deleteForwarderResult {} message deleteForwarderResult {}