Skip to content

Commit

Permalink
chore(cmd): Move FlagClientAgentPort and flagTargetDefaultPort to uint16
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoghx committed Aug 30, 2024
1 parent 5b81bf9 commit db60cef
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions internal/cmd/base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type Command struct {
FlagSkipCacheDaemon bool
FlagSkipClientAgent bool

FlagClientAgentPort uint64
FlagClientAgentPort uint16

FlagScopeId string
FlagScopeName string
Expand Down Expand Up @@ -500,7 +500,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Hidden: true,
})

f.Uint64Var(&Uint64Var{
f.Uint16Var(&Uint16Var{
Name: "client-agent-port",
Target: &c.FlagClientAgentPort,
Default: 9300,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/base/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type Server struct {
DevSecondaryTargetId string // Target using host sources.
DevHostAddress string // Host address for target using host sources.
DevTargetAddress string // Network address for target with address.
DevTargetDefaultPort int64
DevTargetDefaultPort uint16
DevTargetSessionMaxSeconds int64
DevTargetSessionConnectionLimit int64
DevLoopbackPluginId string
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/commands/clientagentcmd/addtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type UpsertTokenRequest struct {
// The passed in cli.Ui is used to print out any errors when looking up the
// auth token from the keyring. This allows background operations calling this
// method to pass in a silent UI to suppress any output.
func addToken(ctx context.Context, apiClient *api.Client, port uint64) (*api.Response, *api.Error, error) {
func addToken(ctx context.Context, apiClient *api.Client, port uint16) (*api.Response, *api.Error, error) {
pa := UpsertTokenRequest{
BoundaryAddr: apiClient.Addr(),
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/commands/clientagentcmd/clientagentcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ func (c *ClientAgentCommand) Run(args []string) int {
}

// clientAgentUrl constructs the full URL for a client agent request given a port and path.
func clientAgentUrl(port uint64, path string) string {
func clientAgentUrl(port uint16, path string) string {
return fmt.Sprintf("http://localhost:%d/%s", port, path)
}
2 changes: 1 addition & 1 deletion internal/cmd/commands/clientagentcmd/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *PauseCommand) Flags() *base.FlagSets {
Usage: "Instead of executing the request, print an equivalent cURL command string and exit.",
})

f.Uint64Var(&base.Uint64Var{
f.Uint16Var(&base.Uint16Var{
Name: "client-agent--port",
Target: &c.FlagClientAgentPort,
Default: 9300,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/commands/clientagentcmd/resume.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *ResumeCommand) Flags() *base.FlagSets {
Usage: "Instead of executing the request, print an equivalent cURL command string and exit.",
})

f.Uint64Var(&base.Uint64Var{
f.Uint16Var(&base.Uint16Var{
Name: "client-agent-port",
Target: &c.FlagClientAgentPort,
Default: 9300,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/commands/clientagentcmd/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (c *SessionsCommand) Flags() *base.FlagSets {
Usage: "Instead of executing the request, print an equivalent cURL command string and exit.",
})

f.Uint64Var(&base.Uint64Var{
f.Uint16Var(&base.Uint16Var{
Name: "client-agent-port",
Target: &c.FlagClientAgentPort,
Default: 9300,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/commands/clientagentcmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (c *StatusCommand) Flags() *base.FlagSets {
Usage: "Instead of executing the request, print an equivalent cURL command string and exit.",
})

f.Uint64Var(&base.Uint64Var{
f.Uint16Var(&base.Uint16Var{
Name: "client-agent-port",
Target: &c.FlagClientAgentPort,
Default: 9300,
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/commands/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type Command struct {
flagIdSuffix string
flagSecondaryIdSuffix string
flagHostAddress string
flagTargetDefaultPort int64
flagTargetDefaultPort uint16
flagTargetSessionMaxSeconds int64
flagTargetSessionConnectionLimit int64
flagControllerApiListenAddr string
Expand Down Expand Up @@ -219,7 +219,7 @@ func (c *Command) Flags() *base.FlagSets {
Usage: "Address to use for the default host that is created. Must be a bare host or IP address, no port.",
})

f.Int64Var(&base.Int64Var{
f.Uint16Var(&base.Uint16Var{
Name: "target-default-port",
Default: 22,
Target: &c.flagTargetDefaultPort,
Expand Down

0 comments on commit db60cef

Please sign in to comment.