Skip to content

Commit

Permalink
Fix small issues (#1782)
Browse files Browse the repository at this point in the history
* make default value of timeout on proxy and vpn to 0

* remove syslog from setup-node

* remove syslog completely from visor
  • Loading branch information
mrpalide authored Mar 21, 2024
1 parent 51093e2 commit e61085c
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 68 deletions.
12 changes: 0 additions & 12 deletions cmd/setup-node/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ import (
"github.com/skycoin/skywire-utilities/pkg/metricsutil"
"github.com/skycoin/skywire/pkg/router"
"github.com/skycoin/skywire/pkg/router/setupmetrics"
"github.com/skycoin/skywire/pkg/syslog"
)

var (
metricsAddr string
syslogAddr string
tag string
cfgFromStdin bool
)

func init() {
RootCmd.Flags().StringVarP(&metricsAddr, "metrics", "m", "", "address to bind metrics API to")
RootCmd.Flags().StringVar(&syslogAddr, "syslog", "", "syslog server address. E.g. localhost:514")
RootCmd.Flags().StringVar(&tag, "tag", "setup_node", "logging tag")
RootCmd.Flags().BoolVarP(&cfgFromStdin, "stdin", "i", false, "read config from STDIN")
}
Expand All @@ -57,15 +54,6 @@ var RootCmd = &cobra.Command{
mLog.Printf("Failed to output build info: %v", err)
}

if syslogAddr != "" {
hook, err := syslog.SetupHook(syslogAddr, tag)
if err != nil {
log.Fatalf("Error setting up syslog: %v", err)
}

logging.AddHook(hook)
}

var rdr io.Reader
var err error

Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func init() {
startCmd.Flags().StringVarP(&pk, "pk", "k", "", "server public key")
startCmd.Flags().StringVarP(&addr, "addr", "a", "", "address of proxy for use")
startCmd.Flags().StringVarP(&clientName, "name", "n", "", "name of skysocks client")
startCmd.Flags().IntVarP(&startingTimeout, "timeout", "t", 30, "timeout for starting proxy")
startCmd.Flags().IntVarP(&startingTimeout, "timeout", "t", 0, "timeout for starting proxy")
startCmd.Flags().StringVar(&httpAddr, "http", "", "address for http proxy")
stopCmd.Flags().BoolVar(&allClients, "all", false, "stop all skysocks client")
stopCmd.Flags().StringVar(&clientName, "name", "", "specific skysocks client that want stop")
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/vpn/vvpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func init() {
listCmd,
)
startCmd.Flags().StringVarP(&pk, "pk", "k", "", "server public key")
startCmd.Flags().IntVarP(&startingTimeout, "timeout", "t", 30, "starting timeout value in second")
startCmd.Flags().IntVarP(&startingTimeout, "timeout", "t", 0, "starting timeout value in second")
}

var startCmd = &cobra.Command{
Expand Down
23 changes: 0 additions & 23 deletions pkg/syslog/syslog_unix.go

This file was deleted.

17 changes: 0 additions & 17 deletions pkg/syslog/syslog_windows.go

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/visor/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var (
// autoPeerIP string
stopVisorWg sync.WaitGroup //nolint:unused
launchBrowser bool
syslogAddr string
logger = logging.MustGetLogger("skywire-visor") //nolint:unused
logLvl string
pprofMode string
Expand Down Expand Up @@ -125,8 +124,6 @@ func init() {
hiddenflags = append(hiddenflags, "pprofaddr")
RootCmd.Flags().StringVarP(&logTag, "logtag", "t", "skywire", "logging tag")
hiddenflags = append(hiddenflags, "logtag")
RootCmd.Flags().StringVarP(&syslogAddr, "syslog", "y", "", "syslog server address. E.g. localhost:514")
hiddenflags = append(hiddenflags, "syslog")
RootCmd.Flags().StringVarP(&completion, "completion", "z", "", "[ bash | zsh | fish | powershell ]")
hiddenflags = append(hiddenflags, "completion")
RootCmd.Flags().BoolVarP(&isStoreLog, "storelog", "l", false, "store all logs to file")
Expand Down
11 changes: 0 additions & 11 deletions pkg/visor/visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"embed"
"errors"
"fmt"
"io"
"io/fs"
"net/http"
"strings"
Expand All @@ -29,7 +28,6 @@ import (
"github.com/skycoin/skywire/pkg/app/launcher"
"github.com/skycoin/skywire/pkg/routefinder/rfclient"
"github.com/skycoin/skywire/pkg/router"
"github.com/skycoin/skywire/pkg/syslog"
"github.com/skycoin/skywire/pkg/transport"
"github.com/skycoin/skywire/pkg/transport/network"
"github.com/skycoin/skywire/pkg/transport/network/addrresolver"
Expand Down Expand Up @@ -346,15 +344,6 @@ func (v *Visor) isStunReady() bool {

func initLogger() *logging.MasterLogger {
mLog := logging.NewMasterLogger()
if syslogAddr != "" {
hook, err := syslog.SetupHook(syslogAddr, logTag)
if err != nil {
mLog.WithError(err).Error("Failed to connect to the syslog daemon.")
} else {
mLog.AddHook(hook)
mLog.Out = io.Discard
}
}
return mLog
}

Expand Down

0 comments on commit e61085c

Please sign in to comment.