Showing 333 of 526 total issues
Avoid deeply nested control flow statements. Open
Open
if err != nil {
log.Errorf("Failed to add hosts(%s) to hosts: %v", entryList2String(appendHosts), err)
}
Function ParseProxyInfo
has 7 return statements (exceeds 4 allowed). Open
Open
func ParseProxyInfo(conn net.Conn) (id stack.TransportEndpointID, err error) {
var n int
var port = make([]byte, 2)
// local port
Function transportTun
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func transportTun(ctx context.Context, tunInbound <-chan *DataElem, tunOutbound chan<- *DataElem, packetConn net.PacketConn, routeMapUDP *RouteMap, routeMapTCP *sync.Map) error {
Avoid deeply nested control flow statements. Open
Open
if err != nil {
log.Errorf("Failed to remove hosts(%s) to hosts: %v", entryList2String(list), err)
}
Method Config.CancelDNS
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *Config) CancelDNS() {
if cancel != nil {
cancel()
}
dir := "/etc/resolver"
Method CloneOptions.InitClient
has 6 return statements (exceeds 4 allowed). Open
Open
func (d *CloneOptions) InitClient(f cmdutil.Factory) (err error) {
d.factory = f
if d.config, err = d.factory.ToRESTConfig(); err != nil {
return
}
Method CloneOptions.setVolume
has 6 return statements (exceeds 4 allowed). Open
Open
func (d *CloneOptions) setVolume(u *unstructured.Unstructured) error {
const TokenVolumeMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"
type VolumeMountContainerPair struct {
Function GetManifest
has 6 return statements (exceeds 4 allowed). Open
Open
func GetManifest(httpCli *http.Client, os string, arch string) (version string, url string, err error) {
var resp *http.Response
var errs []error
for _, a := range address {
resp, err = httpCli.Get(a)
Function CmdRemove
has 6 return statements (exceeds 4 allowed). Open
Open
func CmdRemove(f cmdutil.Factory) *cobra.Command {
var cmd = &cobra.Command{
Use: "remove",
Short: "Remove clone resource",
Long: templates.LongDesc(i18n.T(`
Function UnzipKubeVPNIntoFile
has 6 return statements (exceeds 4 allowed). Open
Open
func UnzipKubeVPNIntoFile(zipFile, filename string) error {
archive, err := zip.OpenReader(zipFile)
if err != nil {
return err
}
Function CmdDaemon
has 6 return statements (exceeds 4 allowed). Open
Open
func CmdDaemon(_ cmdutil.Factory) *cobra.Command {
var opt = &daemon.SvrOption{}
cmd := &cobra.Command{
Use: "daemon",
Short: i18n.T("Startup kubevpn daemon server"),
Method ConnectOptions.portForward
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *ConnectOptions) portForward(ctx context.Context, portPair []string) error {
firstCtx, firstCancelFunc := context.WithCancel(ctx)
defer firstCancelFunc()
var errChan = make(chan error, 1)
go func() {
Function CmdLeave
has 6 return statements (exceeds 4 allowed). Open
Open
func CmdLeave(f cmdutil.Factory) *cobra.Command {
var leaveCmd = &cobra.Command{
Use: "leave",
Short: i18n.T("Leave proxy resource"),
Long: templates.LongDesc(i18n.T(`
Function CmdLogs
has 6 return statements (exceeds 4 allowed). Open
Open
func CmdLogs(f cmdutil.Factory) *cobra.Command {
req := &rpc.LogRequest{}
cmd := &cobra.Command{
Use: "logs",
Short: i18n.T("Log kubevpn daemon grpc server"),
Function DownloadFileWithName
has 6 return statements (exceeds 4 allowed). Open
Open
func DownloadFileWithName(uri, name string) (string, error) {
resp, err := getWithRetry(uri)
if err != nil {
return "", err
}
Function CmdAlias
has 6 return statements (exceeds 4 allowed). Open
Open
func CmdAlias(f cmdutil.Factory) *cobra.Command {
var localFile, remoteAddr string
cmd := &cobra.Command{
Use: "alias",
Short: i18n.T("Config file alias to execute command simply"),
Method ConnectOptions.GetIPFromContext
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *ConnectOptions) GetIPFromContext(ctx context.Context) error {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return fmt.Errorf("can not get IOP from context")
}
Method ConnectOptions.startLocalTunServe
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *ConnectOptions) startLocalTunServe(ctx context.Context, forwardAddress string, lite bool) (err error) {
log.Debugf("IPv4: %s, IPv6: %s", c.localTunIPv4.IP.String(), c.localTunIPv6.IP.String())
var cidrList []*net.IPNet
if !lite {
Function InitFactory
has 6 return statements (exceeds 4 allowed). Open
Open
func InitFactory(kubeconfigBytes string, ns string) cmdutil.Factory {
configFlags := genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag()
configFlags.WrapConfigFn = func(c *rest.Config) *rest.Config {
if path, ok := os.LookupEnv(config.EnvSSHJump); ok {
bytes, err := os.ReadFile(path)
Function DownloadFileWithName
has 6 return statements (exceeds 4 allowed). Open
Open
func DownloadFileWithName(uri, name string) (string, error) {
resp, err := getWithRetry(uri)
if err != nil {
return "", err
}