TUN-5010: --region should be a string flag
This commit is contained in:
parent
671754fd19
commit
98c3957d30
|
@ -494,6 +494,11 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
|
||||||
EnvVars: []string{"TUNNEL_EDGE"},
|
EnvVars: []string{"TUNNEL_EDGE"},
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
}),
|
}),
|
||||||
|
altsrc.NewStringFlag(&cli.StringFlag{
|
||||||
|
Name: "region",
|
||||||
|
Usage: "Cloudflare Edge region to connect to. Omit or set to empty to connect to the global region.",
|
||||||
|
EnvVars: []string{"TUNNEL_REGION"},
|
||||||
|
}),
|
||||||
altsrc.NewStringFlag(&cli.StringFlag{
|
altsrc.NewStringFlag(&cli.StringFlag{
|
||||||
Name: tlsconfig.CaCertFlag,
|
Name: tlsconfig.CaCertFlag,
|
||||||
Usage: "Certificate Authority authenticating connections with Cloudflare's edge network.",
|
Usage: "Certificate Authority authenticating connections with Cloudflare's edge network.",
|
||||||
|
|
|
@ -279,6 +279,7 @@ func prepareTunnelConfig(
|
||||||
OSArch: buildInfo.OSArch(),
|
OSArch: buildInfo.OSArch(),
|
||||||
ClientID: clientID,
|
ClientID: clientID,
|
||||||
EdgeAddrs: c.StringSlice("edge"),
|
EdgeAddrs: c.StringSlice("edge"),
|
||||||
|
Region: c.String("region"),
|
||||||
HAConnections: c.Int("ha-connections"),
|
HAConnections: c.Int("ha-connections"),
|
||||||
IncidentLookup: origin.NewIncidentLookup(),
|
IncidentLookup: origin.NewIncidentLookup(),
|
||||||
IsAutoupdated: c.Bool("is-autoupdated"),
|
IsAutoupdated: c.Bool("is-autoupdated"),
|
||||||
|
|
|
@ -74,7 +74,7 @@ func NewSupervisor(config *TunnelConfig, reconnectCh chan ReconnectSignal, grace
|
||||||
if len(config.EdgeAddrs) > 0 {
|
if len(config.EdgeAddrs) > 0 {
|
||||||
edgeIPs, err = edgediscovery.StaticEdge(config.Log, config.EdgeAddrs)
|
edgeIPs, err = edgediscovery.StaticEdge(config.Log, config.EdgeAddrs)
|
||||||
} else {
|
} else {
|
||||||
edgeIPs, err = edgediscovery.ResolveEdge(config.Log, "")
|
edgeIPs, err = edgediscovery.ResolveEdge(config.Log, config.Region)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -45,6 +45,7 @@ type TunnelConfig struct {
|
||||||
ClientID string
|
ClientID string
|
||||||
CloseConnOnce *sync.Once // Used to close connectedSignal no more than once
|
CloseConnOnce *sync.Once // Used to close connectedSignal no more than once
|
||||||
EdgeAddrs []string
|
EdgeAddrs []string
|
||||||
|
Region string
|
||||||
HAConnections int
|
HAConnections int
|
||||||
IncidentLookup IncidentLookup
|
IncidentLookup IncidentLookup
|
||||||
IsAutoupdated bool
|
IsAutoupdated bool
|
||||||
|
|
Loading…
Reference in New Issue