kubenetworks/kubevpn

View on GitHub

Showing 333 of 526 total issues

Function resizeTtyTo has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func resizeTtyTo(ctx context.Context, apiClient client.ContainerAPIClient, id string, height, width uint, isExec bool) error {
Severity: Minor
Found in pkg/dev/docker_tty.go - About 35 mins to fix

    Function disconnectByKubeConfig has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func disconnectByKubeConfig(ctx context.Context, svr *Server, kubeconfigBytes string, ns string, jump *rpc.SshJump) error {
    Severity: Minor
    Found in pkg/daemon/action/disconnect.go - About 35 mins to fix

      Function transportTunClient has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func transportTunClient(ctx context.Context, tunInbound <-chan *DataElem, tunOutbound chan<- *DataElem, packetConn net.PacketConn, remoteAddr net.Addr) error {
      Severity: Minor
      Found in pkg/core/tunhandlerclient.go - About 35 mins to fix

        Function getDHCPServerClient has 5 return statements (exceeds 4 allowed).
        Open

        func getDHCPServerClient(ctx context.Context, namespace string) (rpc.DHCPClient, error) {
            cert, ok := os.LookupEnv(config.TLSCertKey)
            if !ok {
                return nil, fmt.Errorf("can not get %s from env", config.TLSCertKey)
            }
        Severity: Major
        Found in pkg/handler/tools.go - About 35 mins to fix

          Function ParseAndGet has 5 return statements (exceeds 4 allowed).
          Open

          func ParseAndGet(localFile, remoteAddr string, aliasName string) ([]Config, error) {
              var content []byte
              var err error
              var path string
              if localFile != "" {
          Severity: Major
          Found in cmd/kubevpn/cmds/alias.go - About 35 mins to fix

            Method ConnectOptions.InitClient has 5 return statements (exceeds 4 allowed).
            Open

            func (c *ConnectOptions) InitClient(f cmdutil.Factory) (err error) {
                c.factory = f
                if c.config, err = c.factory.ToRESTConfig(); err != nil {
                    return
                }
            Severity: Major
            Found in pkg/handler/connect.go - About 35 mins to fix

              Function GetAPIServerFromKubeConfigBytes has 5 return statements (exceeds 4 allowed).
              Open

              func GetAPIServerFromKubeConfigBytes(kubeconfigBytes []byte) *net.IPNet {
                  kubeConfig, err := clientcmd.RESTConfigFromKubeConfig(kubeconfigBytes)
                  if err != nil {
                      return nil
                  }
              Severity: Major
              Found in pkg/util/ns.go - About 35 mins to fix

                Function GetVolume has 5 return statements (exceeds 4 allowed).
                Open

                func GetVolume(ctx context.Context, f util.Factory, ns, podName string) (map[string][]mount.Mount, error) {
                    clientSet, err := f.KubernetesClientSet()
                    if err != nil {
                        return nil, err
                    }
                Severity: Major
                Found in pkg/util/volume.go - About 35 mins to fix

                  Function quit has 5 return statements (exceeds 4 allowed).
                  Open

                  func quit(ctx context.Context, isSudo bool) error {
                      cli := daemon.GetClient(isSudo)
                      if cli == nil {
                          return nil
                      }
                  Severity: Major
                  Found in cmd/kubevpn/cmds/quit.go - About 35 mins to fix

                    Method ConnectOptions.LeaveProxyResources has 5 return statements (exceeds 4 allowed).
                    Open

                    func (c *ConnectOptions) LeaveProxyResources(ctx context.Context) (err error) {
                        if c == nil || c.clientset == nil {
                            return
                        }
                    
                    
                    Severity: Major
                    Found in pkg/handler/reset.go - About 35 mins to fix

                      Method CloneOptions.setEnv has 5 return statements (exceeds 4 allowed).
                      Open

                      func (d *CloneOptions) setEnv(u *unstructured.Unstructured) error {
                          temp, path, err := util.GetPodTemplateSpecPath(u)
                          if err != nil {
                              return err
                          }
                      Severity: Major
                      Found in pkg/handler/clone.go - About 35 mins to fix

                        Function NeedsUpgrade has 5 return statements (exceeds 4 allowed).
                        Open

                        func NeedsUpgrade(ctx context.Context, client *http.Client, version string) (url string, latestVersion string, upgrade bool, err error) {
                            latestVersion, url, err = util.GetManifest(client, runtime.GOOS, runtime.GOARCH)
                            if err != nil {
                                v := "https://github.com/kubenetworks/kubevpn/raw/master/plugins/stable.txt"
                                var stream []byte
                        Severity: Major
                        Found in pkg/upgrade/upgrade.go - About 35 mins to fix

                          Function GetNsForListPodAndSvc has 5 return statements (exceeds 4 allowed).
                          Open

                          func GetNsForListPodAndSvc(ctx context.Context, clientset *kubernetes.Clientset, nsList []string) (podNs string, svcNs string, err error) {
                              for _, ns := range nsList {
                                  log.Debugf("List namepsace %s pods", ns)
                                  _, err = clientset.CoreV1().Pods(ns).List(ctx, metav1.ListOptions{Limit: 1})
                                  if apierrors.IsForbidden(err) {
                          Severity: Major
                          Found in pkg/util/route.go - About 35 mins to fix

                            Function CreateFolder has 5 return statements (exceeds 4 allowed).
                            Open

                            func CreateFolder(ctx context.Context, cli *client.Client, id string, src string, target string) (string, error) {
                                lstat, err := os.Lstat(src)
                                if err != nil {
                                    return "", err
                                }
                            Severity: Major
                            Found in pkg/util/volume.go - About 35 mins to fix

                              Function CopyVolumeIntoContainer has 5 return statements (exceeds 4 allowed).
                              Open

                              func CopyVolumeIntoContainer(ctx context.Context, volume []mount.Mount, cli *client.Client, id string) error {
                                  // copy volume into container
                                  for _, v := range volume {
                                      target, err := CreateFolder(ctx, cli, id, v.Source, v.Target)
                                      if err != nil {
                              Severity: Major
                              Found in pkg/util/volume.go - About 35 mins to fix

                                Function runLogsWaitRunning has 5 return statements (exceeds 4 allowed).
                                Open

                                func runLogsWaitRunning(ctx context.Context, dockerCli command.Cli, id string) error {
                                    c, err := dockerCli.Client().ContainerInspect(ctx, id)
                                    if err != nil {
                                        return err
                                    }
                                Severity: Major
                                Found in pkg/dev/docker_utils.go - About 35 mins to fix

                                  Function NewOnAddresses has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func NewOnAddresses(dialer httpstream.Dialer, addresses []string, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error) {
                                      if len(addresses) == 0 {
                                          return nil, errors.New("you must specify at least 1 address")
                                      }
                                      parsedAddresses, err := parseAddresses(addresses)
                                  Severity: Major
                                  Found in pkg/util/portforward.go - About 35 mins to fix

                                    Function cmdConfigAdd has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func cmdConfigAdd(f cmdutil.Factory) *cobra.Command {
                                        var sshConf = &pkgssh.SshConfig{}
                                        cmd := &cobra.Command{
                                            Use:   "add",
                                            Short: i18n.T("Proxy kubeconfig"),
                                    Severity: Major
                                    Found in cmd/kubevpn/cmds/config.go - About 35 mins to fix

                                      Method ConnectOptions.PreCheckResource has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *ConnectOptions) PreCheckResource() error {
                                          if len(c.Workloads) == 0 {
                                              return nil
                                          }
                                      
                                      
                                      Severity: Major
                                      Found in pkg/handler/connect.go - About 35 mins to fix

                                        Function parsePorts has 5 return statements (exceeds 4 allowed).
                                        Open

                                        func parsePorts(ports []string) ([]ForwardedPort, error) {
                                            var forwards []ForwardedPort
                                            for _, portString := range ports {
                                                parts := strings.Split(portString, ":")
                                                var localString, remoteString string
                                        Severity: Major
                                        Found in pkg/util/portforward.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language