mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 07:09:12 +01:00
rename '--agent' flag to '--subordinate' (#748)
This commit is contained in:
parent
9492f93a1d
commit
3fbcaa5f24
@ -20,7 +20,7 @@ func (i *agentGrpcImpl) AccessPrivate(_ context.Context, req *agentGrpc.AccessPr
|
||||
return nil, errors.New("unable to load environment; did you 'zrok enable'?")
|
||||
}
|
||||
|
||||
accCmd := []string{os.Args[0], "access", "private", "--agent", "-b", req.BindAddress, req.Token}
|
||||
accCmd := []string{os.Args[0], "access", "private", "--subordinate", "-b", req.BindAddress, req.Token}
|
||||
acc := &access{
|
||||
token: req.Token,
|
||||
bindAddress: req.BindAddress,
|
||||
|
@ -21,7 +21,7 @@ func (i *agentGrpcImpl) SharePrivate(_ context.Context, req *agentGrpc.SharePriv
|
||||
return nil, errors.New("unable to load environment; did you 'zrok enable'?")
|
||||
}
|
||||
|
||||
shrCmd := []string{os.Args[0], "share", "private", "--agent", "-b", req.BackendMode}
|
||||
shrCmd := []string{os.Args[0], "share", "private", "--subordinate", "-b", req.BackendMode}
|
||||
shr := &share{
|
||||
shareMode: sdk.PrivateShareMode,
|
||||
backendMode: sdk.BackendMode(req.BackendMode),
|
||||
|
@ -21,7 +21,7 @@ func (i *agentGrpcImpl) SharePublic(_ context.Context, req *agentGrpc.SharePubli
|
||||
return nil, errors.New("unable to load environment; did you 'zrok enable'?")
|
||||
}
|
||||
|
||||
shrCmd := []string{os.Args[0], "share", "public", "--agent", "-b", req.BackendMode}
|
||||
shrCmd := []string{os.Args[0], "share", "public", "--subordinate", "-b", req.BackendMode}
|
||||
shr := &share{
|
||||
shareMode: sdk.PublicShareMode,
|
||||
backendMode: sdk.BackendMode(req.BackendMode),
|
||||
|
@ -19,7 +19,7 @@ func (i *agentGrpcImpl) ShareReserved(_ context.Context, req *agentGrpc.ShareRes
|
||||
return nil, errors.New("unable to load environment; did you 'zrok enable'?")
|
||||
}
|
||||
|
||||
shrCmd := []string{os.Args[0], "share", "reserved", "--agent"}
|
||||
shrCmd := []string{os.Args[0], "share", "reserved", "--subordinate"}
|
||||
shr := &share{
|
||||
reserved: true,
|
||||
bootComplete: make(chan struct{}),
|
||||
|
@ -36,7 +36,7 @@ func init() {
|
||||
type accessPrivateCommand struct {
|
||||
bindAddress string
|
||||
headless bool
|
||||
agent bool
|
||||
subordinate bool
|
||||
responseHeaders []string
|
||||
cmd *cobra.Command
|
||||
}
|
||||
@ -49,8 +49,8 @@ func newAccessPrivateCommand() *accessPrivateCommand {
|
||||
}
|
||||
command := &accessPrivateCommand{cmd: cmd}
|
||||
cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
|
||||
cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "agent")
|
||||
cmd.Flags().BoolVar(&command.subordinate, "subordinate", false, "Enable subordinate mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "subordinate")
|
||||
cmd.Flags().StringVarP(&command.bindAddress, "bind", "b", "127.0.0.1:9191", "The address to bind the private frontend")
|
||||
cmd.Flags().StringArrayVar(&command.responseHeaders, "response-header", []string{}, "Add a response header ('key:value')")
|
||||
cmd.Run = command.run
|
||||
@ -70,7 +70,7 @@ func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) {
|
||||
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
cmd.accessLocal(args, root)
|
||||
} else {
|
||||
agent, err := agentClient.IsAgentRunning(root)
|
||||
@ -110,7 +110,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
data := make(map[string]interface{})
|
||||
data["frontend_token"] = accessResp.Payload.FrontendToken
|
||||
data["bind_address"] = cmd.bindAddress
|
||||
@ -271,7 +271,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
||||
}
|
||||
}
|
||||
|
||||
} else if cmd.agent {
|
||||
} else if cmd.subordinate {
|
||||
for {
|
||||
select {
|
||||
case req := <-requests:
|
||||
|
@ -34,7 +34,7 @@ func init() {
|
||||
type sharePrivateCommand struct {
|
||||
backendMode string
|
||||
headless bool
|
||||
agent bool
|
||||
subordinate bool
|
||||
insecure bool
|
||||
closed bool
|
||||
accessGrants []string
|
||||
@ -50,8 +50,8 @@ func newSharePrivateCommand() *sharePrivateCommand {
|
||||
command := &sharePrivateCommand{cmd: cmd}
|
||||
cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, tcpTunnel, udpTunnel, caddy, drive, socks, vpn}")
|
||||
cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
|
||||
cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "agent")
|
||||
cmd.Flags().BoolVar(&command.subordinate, "subordinate", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "subordinate")
|
||||
cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for <target>")
|
||||
cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)")
|
||||
cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)")
|
||||
@ -72,7 +72,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
|
||||
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
cmd.shareLocal(args, root)
|
||||
} else {
|
||||
agent, err := agentClient.IsAgentRunning(root)
|
||||
@ -193,7 +193,7 @@ func (cmd *sharePrivateCommand) shareLocal(args []string, root env_core.Root) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
data := make(map[string]interface{})
|
||||
data["token"] = shr.Token
|
||||
data["frontend_endpoints"] = shr.FrontendEndpoints
|
||||
@ -206,7 +206,7 @@ func (cmd *sharePrivateCommand) shareLocal(args []string, root env_core.Root) {
|
||||
|
||||
shareDescription := fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", shr.Token)))
|
||||
mdl := newShareModel(shr.Token, []string{shareDescription}, sdk.PrivateShareMode, sdk.BackendMode(cmd.backendMode))
|
||||
if !cmd.headless && !cmd.agent {
|
||||
if !cmd.headless && !cmd.subordinate {
|
||||
proxy.SetCaddyLoggingWriter(mdl)
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ func (cmd *sharePrivateCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
}
|
||||
|
||||
} else if cmd.agent {
|
||||
} else if cmd.subordinate {
|
||||
for {
|
||||
select {
|
||||
case req := <-requests:
|
||||
|
@ -34,7 +34,7 @@ type sharePublicCommand struct {
|
||||
frontendSelection []string
|
||||
backendMode string
|
||||
headless bool
|
||||
agent bool
|
||||
subordinate bool
|
||||
insecure bool
|
||||
oauthProvider string
|
||||
oauthEmailAddressPatterns []string
|
||||
@ -59,8 +59,8 @@ func newSharePublicCommand() *sharePublicCommand {
|
||||
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontend", defaultFrontends, "Selected frontends to use for the share")
|
||||
cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, caddy, drive}")
|
||||
cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
|
||||
cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "agent")
|
||||
cmd.Flags().BoolVar(&command.subordinate, "subordinate", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "subordinate")
|
||||
cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for <target>")
|
||||
cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)")
|
||||
cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)")
|
||||
@ -87,7 +87,7 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) {
|
||||
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
cmd.shareLocal(args, root)
|
||||
} else {
|
||||
agent, err := agentClient.IsAgentRunning(root)
|
||||
@ -172,7 +172,7 @@ func (cmd *sharePublicCommand) shareLocal(args []string, root env_core.Root) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
data := make(map[string]interface{})
|
||||
data["token"] = shr.Token
|
||||
data["frontend_endpoints"] = shr.FrontendEndpoints
|
||||
@ -184,7 +184,7 @@ func (cmd *sharePublicCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
|
||||
mdl := newShareModel(shr.Token, shr.FrontendEndpoints, sdk.PublicShareMode, sdk.BackendMode(cmd.backendMode))
|
||||
if !cmd.headless && !cmd.agent {
|
||||
if !cmd.headless && !cmd.subordinate {
|
||||
proxy.SetCaddyLoggingWriter(mdl)
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ func (cmd *sharePublicCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
}
|
||||
|
||||
} else if cmd.agent {
|
||||
} else if cmd.subordinate {
|
||||
for {
|
||||
select {
|
||||
case req := <-requests:
|
||||
|
@ -33,7 +33,7 @@ func init() {
|
||||
type shareReservedCommand struct {
|
||||
overrideEndpoint string
|
||||
headless bool
|
||||
agent bool
|
||||
subordinate bool
|
||||
insecure bool
|
||||
cmd *cobra.Command
|
||||
}
|
||||
@ -47,8 +47,8 @@ func newShareReservedCommand() *shareReservedCommand {
|
||||
command := &shareReservedCommand{cmd: cmd}
|
||||
cmd.Flags().StringVar(&command.overrideEndpoint, "override-endpoint", "", "Override the stored target endpoint with a replacement")
|
||||
cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
|
||||
cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "agent")
|
||||
cmd.Flags().BoolVar(&command.subordinate, "subordinate", false, "Enable agent mode")
|
||||
cmd.MarkFlagsMutuallyExclusive("headless", "subordinate")
|
||||
cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation")
|
||||
cmd.Run = command.run
|
||||
return command
|
||||
@ -67,7 +67,7 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) {
|
||||
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
cmd.shareLocal(args, root)
|
||||
} else {
|
||||
agent, err := agentClient.IsAgentRunning(root)
|
||||
@ -120,7 +120,7 @@ func (cmd *shareReservedCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
|
||||
if resp.Payload.BackendMode != "socks" {
|
||||
if !cmd.agent {
|
||||
if !cmd.subordinate {
|
||||
logrus.Infof("sharing target: '%v'", target)
|
||||
}
|
||||
|
||||
@ -136,11 +136,11 @@ func (cmd *shareReservedCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
if !cmd.agent {
|
||||
if !cmd.subordinate {
|
||||
logrus.Infof("updated backend target to: %v", target)
|
||||
}
|
||||
} else {
|
||||
if !cmd.agent {
|
||||
if !cmd.subordinate {
|
||||
logrus.Infof("using existing backend target: %v", target)
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ func (cmd *shareReservedCommand) shareLocal(args []string, root env_core.Root) {
|
||||
shareDescription = fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", shrToken)))
|
||||
}
|
||||
|
||||
if cmd.agent {
|
||||
if cmd.subordinate {
|
||||
data := make(map[string]interface{})
|
||||
data["token"] = resp.Payload.Token
|
||||
data["backend_mode"] = resp.Payload.BackendMode
|
||||
@ -173,7 +173,7 @@ func (cmd *shareReservedCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
|
||||
mdl := newShareModel(shrToken, []string{shareDescription}, sdk.ShareMode(resp.Payload.ShareMode), sdk.BackendMode(resp.Payload.BackendMode))
|
||||
if !cmd.headless && !cmd.agent {
|
||||
if !cmd.headless && !cmd.subordinate {
|
||||
proxy.SetCaddyLoggingWriter(mdl)
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ func (cmd *shareReservedCommand) shareLocal(args []string, root env_core.Root) {
|
||||
}
|
||||
}
|
||||
|
||||
} else if cmd.agent {
|
||||
} else if cmd.subordinate {
|
||||
for {
|
||||
select {
|
||||
case req := <-requests:
|
||||
|
Loading…
Reference in New Issue
Block a user