From 7d92b06986aafe387ab402c5f18ebd342f4d7a14 Mon Sep 17 00:00:00 2001 From: naison <33818115+wencaiwulue@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:34:02 +0800 Subject: [PATCH] Revert "feat: add ssh foreground" This reverts commit b80e2824534beb6829dca963b19890ef7dc9f1a8. --- cmd/kubevpn/cmds/connect-fork.go | 83 ------------- cmd/kubevpn/cmds/connect.go | 53 +++++---- cmd/kubevpn/cmds/root.go | 1 - pkg/daemon/action/connect-fork.go | 105 ----------------- pkg/daemon/rpc/daemon.pb.go | 189 ++++++++++++++---------------- pkg/daemon/rpc/daemon.proto | 6 +- pkg/daemon/rpc/daemon_grpc.pb.go | 78 ++---------- pkg/handler/connect.go | 1 - 8 files changed, 123 insertions(+), 393 deletions(-) delete mode 100644 cmd/kubevpn/cmds/connect-fork.go delete mode 100644 pkg/daemon/action/connect-fork.go diff --git a/cmd/kubevpn/cmds/connect-fork.go b/cmd/kubevpn/cmds/connect-fork.go deleted file mode 100644 index ef2d6537d..000000000 --- a/cmd/kubevpn/cmds/connect-fork.go +++ /dev/null @@ -1,83 +0,0 @@ -package cmds - -import ( - "fmt" - "os" - "runtime" - - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - cmdutil "k8s.io/kubectl/pkg/cmd/util" - "k8s.io/kubectl/pkg/util/i18n" - "k8s.io/kubectl/pkg/util/templates" - - "github.com/wencaiwulue/kubevpn/pkg/config" - "github.com/wencaiwulue/kubevpn/pkg/handler" - "github.com/wencaiwulue/kubevpn/pkg/util" -) - -func CmdConnectFork(f cmdutil.Factory) *cobra.Command { - var connect = &handler.ConnectOptions{} - var sshConf = &util.SshConfig{} - var transferImage bool - cmd := &cobra.Command{ - Hidden: true, - Use: "connect-fork", - Short: i18n.T("Connect to kubernetes cluster network"), - Long: templates.LongDesc(i18n.T(`Connect to kubernetes cluster network`)), - Example: templates.Examples(i18n.T(` - # Connect to k8s cluster network - kubevpn connect - - # Connect to api-server behind of bastion host or ssh jump host - kubevpn connect --ssh-addr 192.168.1.100:22 --ssh-username root --ssh-keyfile /Users/naison/.ssh/ssh.pem - kubevpn connect --ssh-addr 192.168.1.100:22 --ssh-username root --ssh-keyfile ~/.ssh/ssh.pem - - # it also support ProxyJump, like - ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌────────────┐ - │ pc ├────►│ ssh1 ├────►│ ssh2 ├────►│ ssh3 ├─────►... ─────► │ api-server │ - └──────┘ └──────┘ └──────┘ └──────┘ └────────────┘ - kubevpn connect --ssh-alias - -`)), - PreRunE: func(cmd *cobra.Command, args []string) (err error) { - util.InitLogger(false) - if transferImage { - err = util.TransferImage(cmd.Context(), sshConf, config.OriginImage, config.Image, os.Stdout) - if err != nil { - return err - } - } - return handler.SshJumpAndSetEnv(cmd.Context(), sshConf, cmd.Flags(), true) - }, - RunE: func(cmd *cobra.Command, args []string) error { - runtime.GOMAXPROCS(0) - if err := connect.InitClient(f); err != nil { - return err - } - _, err := connect.RentInnerIP(cmd.Context()) - if err != nil { - return err - } - err = connect.DoConnect(cmd.Context()) - if err != nil { - log.Errorln(err) - connect.Cleanup() - } else { - util.Print(os.Stdout, "Now you can access resources in the kubernetes cluster, enjoy it :)") - } - <-cmd.Context().Done() - return nil - }, - } - cmd.Flags().BoolVar(&config.Debug, "debug", false, "enable debug mode or not, true or false") - cmd.Flags().StringVar(&config.Image, "image", config.Image, "use this image to startup container") - cmd.Flags().StringArrayVar(&connect.ExtraCIDR, "extra-cidr", []string{}, "Extra cidr string, eg: --extra-cidr 192.168.0.159/24 --extra-cidr 192.168.1.160/32") - cmd.Flags().StringArrayVar(&connect.ExtraDomain, "extra-domain", []string{}, "Extra domain string, the resolved ip will add to route table, eg: --extra-domain test.abc.com --extra-domain foo.test.com") - cmd.Flags().BoolVar(&transferImage, "transfer-image", false, "transfer image to remote registry, it will transfer image "+config.OriginImage+" to flags `--image` special image, default: "+config.Image) - cmd.Flags().BoolVar(&connect.UseLocalDNS, "use-localdns", false, "if use-lcoaldns is true, kubevpn will start coredns listen at 53 to forward your dns queries. only support on linux now") - cmd.Flags().StringVar((*string)(&connect.Engine), "engine", string(config.EngineRaw), fmt.Sprintf(`transport engine ("%s"|"%s") %s: use gvisor and raw both (both performance and stable), %s: use raw mode (best stable)`, config.EngineMix, config.EngineRaw, config.EngineMix, config.EngineRaw)) - - addSshFlags(cmd, sshConf) - return cmd -} diff --git a/cmd/kubevpn/cmds/connect.go b/cmd/kubevpn/cmds/connect.go index 05f59c568..8c92adb66 100644 --- a/cmd/kubevpn/cmds/connect.go +++ b/cmd/kubevpn/cmds/connect.go @@ -1,9 +1,11 @@ package cmds import ( + "context" "fmt" "io" "os" + "time" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -61,46 +63,49 @@ func CmdConnect(f cmdutil.Factory) *cobra.Command { SshJump: sshConf.ToRPC(), TransferImage: transferImage, - Foreground: foreground, Image: config.Image, Level: int32(log.DebugLevel), } - // if is foreground, send to sudo daemon server - if foreground { - cli := daemon.GetClient(true) - resp, err := cli.ConnectFork(cmd.Context(), req) - if err != nil { + cli := daemon.GetClient(false) + resp, err := cli.Connect(cmd.Context(), req) + if err != nil { + return err + } + for { + recv, err := resp.Recv() + if err == io.EOF { + break + } else if code := status.Code(err); code == codes.DeadlineExceeded || code == codes.Canceled { + return nil + } else if err != nil { return err } - for { - recv, err := resp.Recv() - if err == io.EOF { - break - } else if code := status.Code(err); code == codes.DeadlineExceeded || code == codes.Canceled { - return nil - } else if err != nil { - return err - } - fmt.Fprint(os.Stdout, recv.GetMessage()) - } - } else { - cli := daemon.GetClient(false) - resp, err := cli.Connect(cmd.Context(), req) + fmt.Fprint(os.Stdout, recv.GetMessage()) + } + util.Print(os.Stdout, "Now you can access resources in the kubernetes cluster, enjoy it :)") + // hangup + if foreground { + // disconnect from cluster network + <-cmd.Context().Done() + + now := time.Now() + stream, err := cli.Disconnect(context.Background(), &rpc.DisconnectRequest{}) + fmt.Printf("call api disconnect use %s\n", time.Now().Sub(now).String()) if err != nil { return err } + var resp *rpc.DisconnectResponse for { - recv, err := resp.Recv() + resp, err = stream.Recv() if err == io.EOF { - break + return nil } else if code := status.Code(err); code == codes.DeadlineExceeded || code == codes.Canceled { return nil } else if err != nil { return err } - fmt.Fprint(os.Stdout, recv.GetMessage()) + fmt.Fprint(os.Stdout, resp.Message) } - util.Print(os.Stdout, "Now you can access resources in the kubernetes cluster, enjoy it :)") } return nil }, diff --git a/cmd/kubevpn/cmds/root.go b/cmd/kubevpn/cmds/root.go index 63673ecb1..c629ee4cd 100644 --- a/cmd/kubevpn/cmds/root.go +++ b/cmd/kubevpn/cmds/root.go @@ -50,7 +50,6 @@ func NewKubeVPNCommand() *cobra.Command { Message: "Develop commands:", Commands: []*cobra.Command{ CmdConnect(factory), - CmdConnectFork(factory), CmdDisconnect(factory), CmdProxy(factory), CmdLeave(factory), diff --git a/pkg/daemon/action/connect-fork.go b/pkg/daemon/action/connect-fork.go deleted file mode 100644 index 25f8e5544..000000000 --- a/pkg/daemon/action/connect-fork.go +++ /dev/null @@ -1,105 +0,0 @@ -package action - -import ( - "context" - "fmt" - "io" - "os" - "os/exec" - "strings" - - log "github.com/sirupsen/logrus" - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/wencaiwulue/kubevpn/pkg/config" - "github.com/wencaiwulue/kubevpn/pkg/daemon/rpc" - "github.com/wencaiwulue/kubevpn/pkg/util" -) - -func (svr *Server) ConnectFork(req *rpc.ConnectRequest, resp rpc.Daemon_ConnectForkServer) error { - defer func() { - log.SetOutput(svr.LogFile) - log.SetLevel(log.DebugLevel) - }() - out := io.MultiWriter(newWarp(resp), svr.LogFile) - log.SetOutput(out) - log.SetLevel(log.InfoLevel) - if !svr.IsSudo { - return fmt.Errorf("connect-fork should not send to sudo daemon server") - } - - ctx := resp.Context() - return fork(ctx, req, out) -} - -func fork(ctx context.Context, req *rpc.ConnectRequest, out io.Writer) error { - exe, err := os.Executable() - if err != nil { - return fmt.Errorf("get executable error: %s", err.Error()) - } - var args = []string{"connect-fork"} - if req.SshJump != nil { - if req.SshJump.Addr != "" { - args = append(args, "--ssh-addr", req.SshJump.Addr) - } - if req.SshJump.User != "" { - args = append(args, "--ssh-username", req.SshJump.User) - } - if req.SshJump.Password != "" { - args = append(args, "--ssh-password", req.SshJump.Password) - } - if req.SshJump.Keyfile != "" { - args = append(args, "--ssh-keyfile", req.SshJump.Keyfile) - } - if req.SshJump.ConfigAlias != "" { // alias in ~/.ssh/config - args = append(args, "--ssh-alias", req.SshJump.ConfigAlias) - } - if req.SshJump.RemoteKubeconfig != "" { // remote path in ssh server - args = append(args, "--remote-kubeconfig", req.SshJump.RemoteKubeconfig) - } - } - if req.KubeconfigBytes != "" { - var path string - path, err = util.ConvertToTempKubeconfigFile([]byte(req.KubeconfigBytes)) - if err != nil { - return err - } - args = append(args, "--kubeconfig", path) - } - if req.Namespace != "" { - args = append(args, "-n", req.Namespace) - } - if req.Image != "" { - args = append(args, "--image", req.Image) - } - if req.TransferImage { - args = append(args, "--transfer-image") - } - for _, v := range req.ExtraCIDR { - args = append(args, "--extra-cidr", v) - } - for _, v := range req.ExtraDomain { - args = append(args, "--extra-domain", v) - } - - env := os.Environ() - envKeys := sets.New[string](config.EnvInboundPodTunIPv4, config.EnvInboundPodTunIPv6, config.EnvTunNameOrLUID) - for i := 0; i < len(env); i++ { - index := strings.Index(env[i], "=") - envKey := env[i][:index] - if envKeys.HasAny(envKey) { - env = append(env[:i], env[i+1:]...) - i-- - continue - } - } - cmd := exec.CommandContext(ctx, exe, args...) - cmd.Env = env - cmd.Stdout = out - cmd.Stderr = out - err = cmd.Run() - if err != nil { - return fmt.Errorf("fork to exec connect error: %s", err.Error()) - } - return nil -} diff --git a/pkg/daemon/rpc/daemon.pb.go b/pkg/daemon/rpc/daemon.pb.go index ee4a074d3..fa0026a5a 100644 --- a/pkg/daemon/rpc/daemon.pb.go +++ b/pkg/daemon/rpc/daemon.pb.go @@ -38,10 +38,8 @@ type ConnectRequest struct { // transfer image TransferImage bool `protobuf:"varint,10,opt,name=TransferImage,proto3" json:"TransferImage,omitempty"` Image string `protobuf:"bytes,11,opt,name=Image,proto3" json:"Image,omitempty"` - // foreground - Foreground bool `protobuf:"varint,12,opt,name=Foreground,proto3" json:"Foreground,omitempty"` // log level - Level int32 `protobuf:"varint,13,opt,name=Level,proto3" json:"Level,omitempty"` + Level int32 `protobuf:"varint,12,opt,name=Level,proto3" json:"Level,omitempty"` } func (x *ConnectRequest) Reset() { @@ -153,13 +151,6 @@ func (x *ConnectRequest) GetImage() string { return "" } -func (x *ConnectRequest) GetForeground() bool { - if x != nil { - return x.Foreground - } - return false -} - func (x *ConnectRequest) GetLevel() int32 { if x != nil { return x.Level @@ -1710,7 +1701,7 @@ var File_daemon_proto protoreflect.FileDescriptor var file_daemon_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, - 0x72, 0x70, 0x63, 0x22, 0x82, 0x04, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, + 0x72, 0x70, 0x63, 0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x4b, 0x75, 0x62, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x4b, 0x75, 0x62, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x79, 0x74, 0x65, 0x73, @@ -1735,10 +1726,8 @@ var file_daemon_proto_rawDesc = []byte{ 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x46, 0x6f, 0x72, 0x65, 0x67, 0x72, - 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x46, 0x6f, 0x72, 0x65, - 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, - 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x3a, 0x0a, 0x0c, + 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, @@ -1880,64 +1869,60 @@ var file_daemon_proto_rawDesc = []byte{ 0x69, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x75, 0x62, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4b, 0x75, 0x62, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x32, - 0xff, 0x06, 0x0a, 0x06, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x07, 0x43, 0x6f, + 0xc1, 0x06, 0x0a, 0x06, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x30, 0x01, 0x12, 0x3c, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x46, - 0x6f, 0x72, 0x6b, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x41, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x12, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, - 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x13, - 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x32, 0x0a, - 0x05, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x65, 0x61, - 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, - 0x01, 0x12, 0x32, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x12, 0x11, 0x2e, 0x72, 0x70, 0x63, - 0x2e, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, - 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x35, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, - 0x12, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3c, 0x0a, 0x09, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, 0x12, 0x15, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x0c, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x18, 0x2e, 0x72, 0x70, 0x63, - 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x2d, 0x0a, 0x04, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x0f, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x72, 0x70, 0x63, - 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, - 0x12, 0x2d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x72, 0x70, 0x63, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x2a, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x0f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x55, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, - 0x63, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x2e, - 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x2f, 0x0a, 0x04, 0x51, 0x75, 0x69, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x51, - 0x75, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x72, 0x70, 0x63, - 0x2e, 0x51, 0x75, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, - 0x01, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x3b, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x22, 0x00, 0x30, 0x01, 0x12, 0x41, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x12, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, + 0x32, 0x0a, 0x05, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, + 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x72, 0x70, + 0x63, 0x2e, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x30, 0x01, 0x12, 0x32, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x12, 0x11, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x35, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x12, 0x12, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3c, + 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, 0x12, 0x15, 0x2e, 0x72, 0x70, + 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, + 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x0c, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x18, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x04, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x0f, 0x2e, 0x72, 0x70, + 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x30, 0x01, 0x12, 0x2d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x2a, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x0f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, + 0x07, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x55, + 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x12, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x51, 0x75, 0x69, 0x74, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x51, 0x75, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x51, 0x75, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x30, 0x01, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x3b, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1995,39 +1980,37 @@ var file_daemon_proto_depIdxs = []int32{ 29, // 4: rpc.ConfigAddRequest.SshJump:type_name -> rpc.SshJump 26, // 5: rpc.GetResponse.metadata:type_name -> rpc.metadata 0, // 6: rpc.Daemon.Connect:input_type -> rpc.ConnectRequest - 0, // 7: rpc.Daemon.ConnectFork:input_type -> rpc.ConnectRequest - 2, // 8: rpc.Daemon.Disconnect:input_type -> rpc.DisconnectRequest - 0, // 9: rpc.Daemon.Proxy:input_type -> rpc.ConnectRequest - 4, // 10: rpc.Daemon.Leave:input_type -> rpc.LeaveRequest - 6, // 11: rpc.Daemon.Clone:input_type -> rpc.CloneRequest - 8, // 12: rpc.Daemon.Remove:input_type -> rpc.RemoveRequest - 16, // 13: rpc.Daemon.ConfigAdd:input_type -> rpc.ConfigAddRequest - 18, // 14: rpc.Daemon.ConfigRemove:input_type -> rpc.ConfigRemoveRequest - 20, // 15: rpc.Daemon.Logs:input_type -> rpc.LogRequest - 22, // 16: rpc.Daemon.List:input_type -> rpc.ListRequest - 24, // 17: rpc.Daemon.Get:input_type -> rpc.GetRequest - 27, // 18: rpc.Daemon.Upgrade:input_type -> rpc.UpgradeRequest - 12, // 19: rpc.Daemon.Status:input_type -> rpc.StatusRequest - 14, // 20: rpc.Daemon.Version:input_type -> rpc.VersionRequest - 10, // 21: rpc.Daemon.Quit:input_type -> rpc.QuitRequest - 1, // 22: rpc.Daemon.Connect:output_type -> rpc.ConnectResponse - 1, // 23: rpc.Daemon.ConnectFork:output_type -> rpc.ConnectResponse - 3, // 24: rpc.Daemon.Disconnect:output_type -> rpc.DisconnectResponse - 1, // 25: rpc.Daemon.Proxy:output_type -> rpc.ConnectResponse - 5, // 26: rpc.Daemon.Leave:output_type -> rpc.LeaveResponse - 7, // 27: rpc.Daemon.Clone:output_type -> rpc.CloneResponse - 9, // 28: rpc.Daemon.Remove:output_type -> rpc.RemoveResponse - 17, // 29: rpc.Daemon.ConfigAdd:output_type -> rpc.ConfigAddResponse - 19, // 30: rpc.Daemon.ConfigRemove:output_type -> rpc.ConfigRemoveResponse - 21, // 31: rpc.Daemon.Logs:output_type -> rpc.LogResponse - 23, // 32: rpc.Daemon.List:output_type -> rpc.ListResponse - 25, // 33: rpc.Daemon.Get:output_type -> rpc.GetResponse - 28, // 34: rpc.Daemon.Upgrade:output_type -> rpc.UpgradeResponse - 13, // 35: rpc.Daemon.Status:output_type -> rpc.StatusResponse - 15, // 36: rpc.Daemon.Version:output_type -> rpc.VersionResponse - 11, // 37: rpc.Daemon.Quit:output_type -> rpc.QuitResponse - 22, // [22:38] is the sub-list for method output_type - 6, // [6:22] is the sub-list for method input_type + 2, // 7: rpc.Daemon.Disconnect:input_type -> rpc.DisconnectRequest + 0, // 8: rpc.Daemon.Proxy:input_type -> rpc.ConnectRequest + 4, // 9: rpc.Daemon.Leave:input_type -> rpc.LeaveRequest + 6, // 10: rpc.Daemon.Clone:input_type -> rpc.CloneRequest + 8, // 11: rpc.Daemon.Remove:input_type -> rpc.RemoveRequest + 16, // 12: rpc.Daemon.ConfigAdd:input_type -> rpc.ConfigAddRequest + 18, // 13: rpc.Daemon.ConfigRemove:input_type -> rpc.ConfigRemoveRequest + 20, // 14: rpc.Daemon.Logs:input_type -> rpc.LogRequest + 22, // 15: rpc.Daemon.List:input_type -> rpc.ListRequest + 24, // 16: rpc.Daemon.Get:input_type -> rpc.GetRequest + 27, // 17: rpc.Daemon.Upgrade:input_type -> rpc.UpgradeRequest + 12, // 18: rpc.Daemon.Status:input_type -> rpc.StatusRequest + 14, // 19: rpc.Daemon.Version:input_type -> rpc.VersionRequest + 10, // 20: rpc.Daemon.Quit:input_type -> rpc.QuitRequest + 1, // 21: rpc.Daemon.Connect:output_type -> rpc.ConnectResponse + 3, // 22: rpc.Daemon.Disconnect:output_type -> rpc.DisconnectResponse + 1, // 23: rpc.Daemon.Proxy:output_type -> rpc.ConnectResponse + 5, // 24: rpc.Daemon.Leave:output_type -> rpc.LeaveResponse + 7, // 25: rpc.Daemon.Clone:output_type -> rpc.CloneResponse + 9, // 26: rpc.Daemon.Remove:output_type -> rpc.RemoveResponse + 17, // 27: rpc.Daemon.ConfigAdd:output_type -> rpc.ConfigAddResponse + 19, // 28: rpc.Daemon.ConfigRemove:output_type -> rpc.ConfigRemoveResponse + 21, // 29: rpc.Daemon.Logs:output_type -> rpc.LogResponse + 23, // 30: rpc.Daemon.List:output_type -> rpc.ListResponse + 25, // 31: rpc.Daemon.Get:output_type -> rpc.GetResponse + 28, // 32: rpc.Daemon.Upgrade:output_type -> rpc.UpgradeResponse + 13, // 33: rpc.Daemon.Status:output_type -> rpc.StatusResponse + 15, // 34: rpc.Daemon.Version:output_type -> rpc.VersionResponse + 11, // 35: rpc.Daemon.Quit:output_type -> rpc.QuitResponse + 21, // [21:36] is the sub-list for method output_type + 6, // [6:21] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name 6, // [6:6] is the sub-list for extension extendee 0, // [0:6] is the sub-list for field type_name diff --git a/pkg/daemon/rpc/daemon.proto b/pkg/daemon/rpc/daemon.proto index aa1011960..85d06fdf0 100644 --- a/pkg/daemon/rpc/daemon.proto +++ b/pkg/daemon/rpc/daemon.proto @@ -6,7 +6,6 @@ package rpc; service Daemon { rpc Connect (ConnectRequest) returns (stream ConnectResponse) {} - rpc ConnectFork (ConnectRequest) returns (stream ConnectResponse) {} rpc Disconnect (DisconnectRequest) returns (stream DisconnectResponse) {} rpc Proxy (ConnectRequest) returns (stream ConnectResponse) {} rpc Leave (LeaveRequest) returns (stream LeaveResponse) {} @@ -41,11 +40,8 @@ message ConnectRequest { bool TransferImage = 10; string Image = 11; - // foreground - bool Foreground = 12; - // log level - int32 Level = 13; + int32 Level = 12; } message ConnectResponse { diff --git a/pkg/daemon/rpc/daemon_grpc.pb.go b/pkg/daemon/rpc/daemon_grpc.pb.go index 3a6207841..a90a8d04f 100644 --- a/pkg/daemon/rpc/daemon_grpc.pb.go +++ b/pkg/daemon/rpc/daemon_grpc.pb.go @@ -20,7 +20,6 @@ const _ = grpc.SupportPackageIsVersion7 const ( Daemon_Connect_FullMethodName = "/rpc.Daemon/Connect" - Daemon_ConnectFork_FullMethodName = "/rpc.Daemon/ConnectFork" Daemon_Disconnect_FullMethodName = "/rpc.Daemon/Disconnect" Daemon_Proxy_FullMethodName = "/rpc.Daemon/Proxy" Daemon_Leave_FullMethodName = "/rpc.Daemon/Leave" @@ -42,7 +41,6 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type DaemonClient interface { Connect(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Daemon_ConnectClient, error) - ConnectFork(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Daemon_ConnectForkClient, error) Disconnect(ctx context.Context, in *DisconnectRequest, opts ...grpc.CallOption) (Daemon_DisconnectClient, error) Proxy(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Daemon_ProxyClient, error) Leave(ctx context.Context, in *LeaveRequest, opts ...grpc.CallOption) (Daemon_LeaveClient, error) @@ -99,40 +97,8 @@ func (x *daemonConnectClient) Recv() (*ConnectResponse, error) { return m, nil } -func (c *daemonClient) ConnectFork(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Daemon_ConnectForkClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[1], Daemon_ConnectFork_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &daemonConnectForkClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Daemon_ConnectForkClient interface { - Recv() (*ConnectResponse, error) - grpc.ClientStream -} - -type daemonConnectForkClient struct { - grpc.ClientStream -} - -func (x *daemonConnectForkClient) Recv() (*ConnectResponse, error) { - m := new(ConnectResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *daemonClient) Disconnect(ctx context.Context, in *DisconnectRequest, opts ...grpc.CallOption) (Daemon_DisconnectClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[2], Daemon_Disconnect_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[1], Daemon_Disconnect_FullMethodName, opts...) if err != nil { return nil, err } @@ -164,7 +130,7 @@ func (x *daemonDisconnectClient) Recv() (*DisconnectResponse, error) { } func (c *daemonClient) Proxy(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Daemon_ProxyClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[3], Daemon_Proxy_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[2], Daemon_Proxy_FullMethodName, opts...) if err != nil { return nil, err } @@ -196,7 +162,7 @@ func (x *daemonProxyClient) Recv() (*ConnectResponse, error) { } func (c *daemonClient) Leave(ctx context.Context, in *LeaveRequest, opts ...grpc.CallOption) (Daemon_LeaveClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[4], Daemon_Leave_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[3], Daemon_Leave_FullMethodName, opts...) if err != nil { return nil, err } @@ -228,7 +194,7 @@ func (x *daemonLeaveClient) Recv() (*LeaveResponse, error) { } func (c *daemonClient) Clone(ctx context.Context, in *CloneRequest, opts ...grpc.CallOption) (Daemon_CloneClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[5], Daemon_Clone_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[4], Daemon_Clone_FullMethodName, opts...) if err != nil { return nil, err } @@ -260,7 +226,7 @@ func (x *daemonCloneClient) Recv() (*CloneResponse, error) { } func (c *daemonClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (Daemon_RemoveClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[6], Daemon_Remove_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[5], Daemon_Remove_FullMethodName, opts...) if err != nil { return nil, err } @@ -310,7 +276,7 @@ func (c *daemonClient) ConfigRemove(ctx context.Context, in *ConfigRemoveRequest } func (c *daemonClient) Logs(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (Daemon_LogsClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[7], Daemon_Logs_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[6], Daemon_Logs_FullMethodName, opts...) if err != nil { return nil, err } @@ -387,7 +353,7 @@ func (c *daemonClient) Version(ctx context.Context, in *VersionRequest, opts ... } func (c *daemonClient) Quit(ctx context.Context, in *QuitRequest, opts ...grpc.CallOption) (Daemon_QuitClient, error) { - stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[8], Daemon_Quit_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &Daemon_ServiceDesc.Streams[7], Daemon_Quit_FullMethodName, opts...) if err != nil { return nil, err } @@ -423,7 +389,6 @@ func (x *daemonQuitClient) Recv() (*QuitResponse, error) { // for forward compatibility type DaemonServer interface { Connect(*ConnectRequest, Daemon_ConnectServer) error - ConnectFork(*ConnectRequest, Daemon_ConnectForkServer) error Disconnect(*DisconnectRequest, Daemon_DisconnectServer) error Proxy(*ConnectRequest, Daemon_ProxyServer) error Leave(*LeaveRequest, Daemon_LeaveServer) error @@ -448,9 +413,6 @@ type UnimplementedDaemonServer struct { func (UnimplementedDaemonServer) Connect(*ConnectRequest, Daemon_ConnectServer) error { return status.Errorf(codes.Unimplemented, "method Connect not implemented") } -func (UnimplementedDaemonServer) ConnectFork(*ConnectRequest, Daemon_ConnectForkServer) error { - return status.Errorf(codes.Unimplemented, "method ConnectFork not implemented") -} func (UnimplementedDaemonServer) Disconnect(*DisconnectRequest, Daemon_DisconnectServer) error { return status.Errorf(codes.Unimplemented, "method Disconnect not implemented") } @@ -527,27 +489,6 @@ func (x *daemonConnectServer) Send(m *ConnectResponse) error { return x.ServerStream.SendMsg(m) } -func _Daemon_ConnectFork_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ConnectRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DaemonServer).ConnectFork(m, &daemonConnectForkServer{stream}) -} - -type Daemon_ConnectForkServer interface { - Send(*ConnectResponse) error - grpc.ServerStream -} - -type daemonConnectForkServer struct { - grpc.ServerStream -} - -func (x *daemonConnectForkServer) Send(m *ConnectResponse) error { - return x.ServerStream.SendMsg(m) -} - func _Daemon_Disconnect_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(DisconnectRequest) if err := stream.RecvMsg(m); err != nil { @@ -863,11 +804,6 @@ var Daemon_ServiceDesc = grpc.ServiceDesc{ Handler: _Daemon_Connect_Handler, ServerStreams: true, }, - { - StreamName: "ConnectFork", - Handler: _Daemon_ConnectFork_Handler, - ServerStreams: true, - }, { StreamName: "Disconnect", Handler: _Daemon_Disconnect_Handler, diff --git a/pkg/handler/connect.go b/pkg/handler/connect.go index 991ef0243..00e8bbb5c 100644 --- a/pkg/handler/connect.go +++ b/pkg/handler/connect.go @@ -77,7 +77,6 @@ type ConnectOptions struct { ExtraDomain []string UseLocalDNS bool Engine config.Engine - Foreground bool ctx context.Context cancel context.CancelFunc