Skip to content

Commit

Permalink
fix CI errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0pcom committed Sep 21, 2024
1 parent 2adcf47 commit f2bae22
Show file tree
Hide file tree
Showing 122 changed files with 368 additions and 16,625 deletions.
6 changes: 4 additions & 2 deletions cmd/apps/skychat/commands/skychat.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ func sseHandler(w http.ResponseWriter, req *http.Request) {
if !ok {
return
}
_, _ = fmt.Fprintf(w, "data: %s\n\n", msg)
f.Flush()
_, err := fmt.Fprintf(w, "data: %s\n\n", msg)
if err == nil {
f.Flush()
}

case <-req.Context().Done():
fmt.Print("SSE connection were closed.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/apps/vpn-server/commands/vpn-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var RootCmd = &cobra.Command{
DisableSuggestions: true,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
appCl := app.NewClient(nil)
defer appCl.Close()

Expand Down
3 changes: 1 addition & 2 deletions cmd/skywire-cli/commands/config/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func init() {
}
genConfigCmd.Flags().VarP(&sk, "sk", "s", "a random key is generated if unspecified\n\r")
gHiddenFlags = append(gHiddenFlags, "sk")
genConfigCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", scriptExecBool("${TESTENV:-false}"), "use test deployment "+testConf+"\033[0m")
genConfigCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", scriptExecBool("${TESTENV:-false}"), "use test deployment\033[0m")
gHiddenFlags = append(gHiddenFlags, "testenv")
genConfigCmd.Flags().BoolVarP(&isVpnServerEnable, "servevpn", "v", scriptExecBool("${VPNSERVER:-false}"), "enable vpn server\033[0m")
gHiddenFlags = append(gHiddenFlags, "servevpn")
Expand Down Expand Up @@ -521,7 +521,6 @@ var genConfigCmd = &cobra.Command{
}
}


//generate the common config containing public & secret keys
u := buildinfo.Version()
x := u
Expand Down
4 changes: 2 additions & 2 deletions cmd/skywire-cli/commands/config/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ var (
disableApps string
isBestProtocol bool
serviceConfURL = "http://conf.skywire.skycoin.com"
testServiceConfURL = "http://conf.skywire.dev"
dnsServer = "1.1.1.1"
testServiceConfURL = "http://conf.skywire.dev"
dnsServer = "1.1.1.1"
services visorconfig.Services
servicesConfig servicesConf
isForce bool
Expand Down
11 changes: 6 additions & 5 deletions cmd/skywire-cli/commands/config/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
coinCipher "github.com/skycoin/skycoin/src/cipher"
"github.com/spf13/cobra"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire/pkg/dmsgc"
Expand All @@ -31,8 +32,8 @@ func init() {
updateCmd.Flags().SortFlags = false
updateCmd.Flags().BoolVarP(&isUpdateEndpoints, "endpoints", "a", false, "update server endpoints")
updateCmd.Flags().StringVar(&logLevel, "log-level", "", "level of logging in config")
updateCmd.Flags().StringVarP(&serviceConfURL, "url", "b", "", "service config URL: "+svcConf)
updateCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", false, "use test deployment: "+testConf)
updateCmd.Flags().StringVarP(&serviceConfURL, "url", "b", skywire.ConfService, "service config URL")
updateCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", false, "use test deployment")
updateCmd.Flags().StringVar(&setPublicAutoconnect, "public-autoconn", "", "change public autoconnect configuration")
updateCmd.Flags().IntVar(&minHops, "set-minhop", -1, "change min hops value")
updateCmd.PersistentFlags().StringVarP(&input, "input", "i", "", "path of input config file.")
Expand Down Expand Up @@ -91,9 +92,9 @@ var updateCmd = &cobra.Command{
PreRun: func(_ *cobra.Command, _ []string) {
if isUpdateEndpoints && (serviceConfURL == "") {
if !isTestEnv {
serviceConfURL = svcConf
serviceConfURL = skywire.ConfService
} else {
serviceConfURL = testConf
serviceConfURL = skywire.ConfServiceTest
}
}
setDefaults()
Expand All @@ -106,7 +107,7 @@ var updateCmd = &cobra.Command{
conf = initUpdate()
if isUpdateEndpoints {
if isTestEnv {
serviceConfURL = testConf
serviceConfURL = skywire.ConfServiceTest
}
mLog := logging.NewMasterLogger()
mLog.SetLevel(logrus.InfoLevel)
Expand Down
3 changes: 1 addition & 2 deletions cmd/skywire-cli/commands/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ import (
)

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
dmsgDiscURL = services.DmsgDiscovery
utURL = services.UptimeTracker
Expand Down
4 changes: 2 additions & 2 deletions cmd/skywire-cli/commands/log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
)

var (
dmsgDiscURL string
utURL string
dmsgDiscURL string
utURL string
pubKey string
duration int
minv string
Expand Down
9 changes: 4 additions & 5 deletions cmd/skywire-cli/commands/mdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package climdisc
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"os"
Expand All @@ -16,6 +17,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire/cmd/skywire-cli/internal"
Expand All @@ -26,22 +28,19 @@ var (
cacheFilesAge int
mdURL string
isStats bool
dmsgDiscURL string

dmsgDiscURL string
)

// var allEntries bool
var masterLogger = logging.NewMasterLogger()
var packageLogger = masterLogger.PackageLogger("mdisc:disc")

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
dmsgDiscURL = services.DmsgDiscovery
utURL = services.UptimeTracker
}
}
RootCmd.AddCommand(
Expand Down
5 changes: 3 additions & 2 deletions cmd/skywire-cli/commands/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package skysocksc
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"strings"
Expand All @@ -15,6 +16,7 @@ import (
"github.com/spf13/cobra"
"github.com/tidwall/pretty"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/buildinfo"
"github.com/skycoin/skywire-utilities/pkg/cmdutil"
clirpc "github.com/skycoin/skywire/cmd/skywire-cli/commands/rpc"
Expand Down Expand Up @@ -257,10 +259,9 @@ var statusCmd = &cobra.Command{
var isLabel bool

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
svcDiscURL = services.DmsgDiscovery
utURL = services.UptimeTracker
Expand Down
3 changes: 1 addition & 2 deletions cmd/skywire-cli/commands/proxy/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ var (
addr string
startingTimeout int
httpAddr string
svcDiscURL string
utURL string
svcDiscURL string
)

// RootCmd contains commands that interact with the skywire-visor
Expand Down
8 changes: 4 additions & 4 deletions cmd/skywire-cli/commands/rewards/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/base64"
"encoding/csv"
"encoding/json"
"fmt"
htmpl "html/template"
"io"
Expand All @@ -29,16 +30,16 @@ import (
dmsg "github.com/skycoin/dmsg/pkg/dmsg"
"github.com/spf13/cobra"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/cmdutil"
"github.com/skycoin/skywire-utilities/pkg/logging"
)

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
dmsgDiscURL = services.DmsgDiscovery
}
Expand Down Expand Up @@ -100,8 +101,7 @@ var (
wlkeys []cipher.PubKey
webPort uint
ensureOnlineURL string
dmsgDiscURL string

dmsgDiscURL string
)

var skyenvfile = os.Getenv("SKYENV")
Expand Down
18 changes: 9 additions & 9 deletions cmd/skywire-cli/commands/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cliroute

import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
Expand All @@ -17,32 +18,31 @@ import (
"github.com/spf13/pflag"
"golang.org/x/net/context"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/cipher"
clirpc "github.com/skycoin/skywire/cmd/skywire-cli/commands/rpc"
"github.com/skycoin/skywire/cmd/skywire-cli/internal"
"github.com/skycoin/skywire/pkg/routefinder/rfclient"
"github.com/skycoin/skywire/pkg/router"
"github.com/skycoin/skywire/pkg/routing"
"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire/pkg/skyenv"
"github.com/skycoin/skywire/pkg/visor/visorconfig"
)

var (
frAddr string
frMinHops, frMaxHops uint16
timeout time.Duration
skywireconfig string
rfURL string
frAddr string
frMinHops, frMaxHops uint16
timeout time.Duration
skywireconfig string
rfURL string
)

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
rfURL = services.RouteFinderAddr
rfURL = services.RouteFinder
}
}
findCmd.Flags().SortFlags = false
Expand Down
6 changes: 3 additions & 3 deletions cmd/skywire-cli/commands/survey/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/skycoin/dmsg/pkg/dmsg"
"github.com/spf13/cobra"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/cmdutil"
"github.com/skycoin/skywire-utilities/pkg/logging"
Expand All @@ -32,14 +33,13 @@ var (
pkgconfigexists bool
userconfigexists bool
conf *visorconfig.V1
dmsgDiscURL string
dmsgDiscURL string
)

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
dmsgDiscURL = services.DmsgDiscovery
}
Expand Down
13 changes: 6 additions & 7 deletions cmd/skywire-cli/commands/tp/tp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package clitp

import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
Expand All @@ -20,6 +21,7 @@ import (
"github.com/spf13/pflag"
"github.com/tidwall/pretty"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/logging"
clirpc "github.com/skycoin/skywire/cmd/skywire-cli/commands/rpc"
Expand All @@ -36,16 +38,15 @@ var (
logger = logging.MustGetLogger("skywire-cli")
removeAll bool
tpTypes bool
tpDiscURL string
sdURL string
utURL string
tpDiscURL string
sdURL string
utURL string
)

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
tpDiscURL = services.TransportDiscovery
sdURL = services.ServiceDiscovery
Expand Down Expand Up @@ -121,7 +122,6 @@ var tpCmd = &cobra.Command{

var (
sortedEdgeKeys []string
utURL string
tpdURL string
rootNode string
lastNode string
Expand All @@ -138,7 +138,6 @@ var (
transportType string
timeout time.Duration
rpk string
sdURL string
cacheFileSD string
cacheFilesAge int
forceAttempt bool
Expand Down
7 changes: 4 additions & 3 deletions cmd/skywire-cli/commands/ut/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
package cliut

import (
"encoding/json"
"fmt"
"os"

"github.com/bitfield/script"
"github.com/spf13/cobra"

"github.com/skycoin/skywire"
"github.com/skycoin/skywire/cmd/skywire-cli/internal"
)

Expand All @@ -27,10 +29,9 @@ var (
var minUT int

func init() {
log := logging.MustGetLogger("skywire-cli")
var envServices skywire.EnvServices
var services skywire.Services
if err := json.Unmarshal([]byte(jsonData), &envServices); err == nil {
if err := json.Unmarshal([]byte(skywire.ServicesJSON), &envServices); err == nil {
if err := json.Unmarshal(envServices.Prod, &services); err == nil {
utURL = services.UptimeTracker
}
Expand All @@ -48,7 +49,7 @@ func init() {
var utCmd = &cobra.Command{
Use: "ut",
Short: "query uptime tracker",
Long: fmt.Sprintf("query uptime tracker\n\n%v/uptimes?v=v2\n\nCheck local visor daily uptime percent with:\n skywire-cli ut -k $(skywire-cli visor pk)n\nSet cache file location to \"\" to avoid using cache files", utilenv.UptimeTrackerAddr),
Long: fmt.Sprintf("query uptime tracker\n\n%v/uptimes?v=v2\n\nCheck local visor daily uptime percent with:\n skywire-cli ut -k $(skywire-cli visor pk)n\nSet cache file location to \"\" to avoid using cache files", utURL),
Run: func(cmd *cobra.Command, _ []string) {
uts := internal.GetData(cacheFileUT, utURL+"/uptimes?v=v2", cacheFilesAge)
if online {
Expand Down
Loading

0 comments on commit f2bae22

Please sign in to comment.