Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve dmsghttp handler logic #76

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/address-resolver/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
testEnvironment bool
sk cipher.SecKey
dmsgPort uint16
dmsgServerType string
)

func init() {
Expand All @@ -64,6 +65,7 @@ func init() {
RootCmd.Flags().BoolVar(&testEnvironment, "test-environment", false, "distinguished between prod and test environment\033[0m")
RootCmd.Flags().Var(&sk, "sk", "dmsg secret key\r")
RootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value\r")
RootCmd.Flags().StringVar(&dmsgServerType, "dmsg-server-type", "", "type of dmsg server on dmsghttp handler")
var helpflag bool
RootCmd.SetUsageTemplate(help)
RootCmd.PersistentFlags().BoolVarP(&helpflag, "help", "h", false, "help for address-resolver")
Expand Down Expand Up @@ -195,8 +197,9 @@ skywire svc ar --addr ":9093" --redis "redis://localhost:6379" --sk $(tail -n1 a
keys = append(keys, pk)
dClient := direct.NewClient(direct.GetAllEntries(keys, servers), logger)
config := &dmsg.Config{
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
ConnectedServersType: dmsgServerType,
}

dmsgDC, closeDmsgDC, err := direct.StartDmsg(ctx, logger, pk, sk, dClient, config)
Expand Down
21 changes: 12 additions & 9 deletions cmd/config-bootstrapper/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ import (
)

var (
addr string
tag string
stunPath string
domain string
dmsgDisc string
sk cipher.SecKey
dmsgPort uint16
addr string
tag string
stunPath string
domain string
dmsgDisc string
sk cipher.SecKey
dmsgPort uint16
dmsgServerType string
)

func init() {
Expand All @@ -42,6 +43,7 @@ func init() {
RootCmd.Flags().StringVar(&dmsgDisc, "dmsg-disc", "http://dmsgd.skywire.skycoin.com", "url of dmsg-discovery\033[0m")
RootCmd.Flags().Var(&sk, "sk", "dmsg secret key\r")
RootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value\r")
RootCmd.Flags().StringVar(&dmsgServerType, "dmsg-server-type", "", "type of dmsg server on dmsghttp handler")
}

// RootCmd contains the root command
Expand Down Expand Up @@ -92,8 +94,9 @@ var RootCmd = &cobra.Command{
keys = append(keys, pk)
dClient := direct.NewClient(direct.GetAllEntries(keys, servers), logger)
config := &dmsg.Config{
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
ConnectedServersType: dmsgServerType,
}

dmsgDC, closeDmsgDC, err := direct.StartDmsg(ctx, logger, pk, sk, dClient, config)
Expand Down
29 changes: 16 additions & 13 deletions cmd/route-finder/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ import (
)

var (
addr string
metricsAddr string
pgHost string
pgPort string
logLvl string
tag string
testing bool
dmsgDisc string
sk cipher.SecKey
dmsgPort uint16
pgMaxOpenConn int
addr string
metricsAddr string
pgHost string
pgPort string
logLvl string
tag string
testing bool
dmsgDisc string
sk cipher.SecKey
dmsgPort uint16
dmsgServerType string
pgMaxOpenConn int
)

func init() {
Expand All @@ -54,6 +55,7 @@ func init() {
RootCmd.Flags().StringVar(&dmsgDisc, "dmsg-disc", "http://dmsgd.skywire.skycoin.com", "url of dmsg-discovery\033[0m")
RootCmd.Flags().Var(&sk, "sk", "dmsg secret key\r")
RootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value\r")
RootCmd.Flags().StringVar(&dmsgServerType, "dmsg-server-type", "", "type of dmsg server on dmsghttp handler")
}

// RootCmd contains the root command
Expand Down Expand Up @@ -150,8 +152,9 @@ PG_USER="postgres" PG_DATABASE="rf" PG_PASSWORD="" route-finder --addr ":9092"
keys = append(keys, pk)
dClient := direct.NewClient(direct.GetAllEntries(keys, servers), logger)
config := &dmsg.Config{
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
ConnectedServersType: dmsgServerType,
}

dmsgDC, closeDmsgDC, err := direct.StartDmsg(ctx, logger, pk, sk, dClient, config)
Expand Down
7 changes: 5 additions & 2 deletions cmd/transport-discovery/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var (
testEnvironment bool
sk cipher.SecKey
dmsgPort uint16
dmsgServerType string
pgMaxOpenConn int
)

Expand All @@ -70,6 +71,7 @@ func init() {
RootCmd.Flags().BoolVar(&testEnvironment, "test-environment", false, "distinguished between prod and test environment\033[0m")
RootCmd.Flags().Var(&sk, "sk", "dmsg secret key\r")
RootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value\r")
RootCmd.Flags().StringVar(&dmsgServerType, "dmsg-server-type", "", "type of dmsg server on dmsghttp handler")
}

// RootCmd contains the root command
Expand Down Expand Up @@ -204,8 +206,9 @@ PG_USER="postgres" PG_DATABASE="tpd" PG_PASSWORD="" transport-discovery --sk $(t
keys = append(keys, pk)
dClient := direct.NewClient(direct.GetAllEntries(keys, servers), logger)
config := &dmsg.Config{
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
ConnectedServersType: dmsgServerType,
}

dmsgDC, closeDmsgDC, err := direct.StartDmsg(ctx, logger, pk, sk, dClient, config)
Expand Down
7 changes: 5 additions & 2 deletions cmd/uptime-tracker/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var (
dmsgDisc string
sk cipher.SecKey
dmsgPort uint16
dmsgServerType string
storeDataCutoff int
storeDataPath string
)
Expand All @@ -76,6 +77,7 @@ func init() {
rootCmd.Flags().StringVar(&dmsgDisc, "dmsg-disc", "http://dmsgd.skywire.skycoin.com", "url of dmsg-discovery")
rootCmd.Flags().Var(&sk, "sk", "dmsg secret key")
rootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value\r")
rootCmd.Flags().StringVar(&dmsgServerType, "dmsg-server-type", "", "type of dmsg server on dmsghttp handler")
}

var rootCmd = &cobra.Command{
Expand Down Expand Up @@ -184,8 +186,9 @@ var rootCmd = &cobra.Command{
keys = append(keys, pk)
dClient := direct.NewClient(direct.GetAllEntries(keys, servers), logger)
config := &dmsg.Config{
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
MinSessions: 0, // listen on all available servers
UpdateInterval: dmsg.DefaultUpdateInterval,
ConnectedServersType: dmsgServerType,
}

dmsgDC, closeDmsgDC, err := direct.StartDmsg(ctx, logger, pk, sk, dClient, config)
Expand Down
Loading