Skip to content

Commit

Permalink
Minor fixes before version release (#41)
Browse files Browse the repository at this point in the history
* Fixed missing REQUIRED notes
* revert incorrect filename numbering
* remove irrelevant MarkHidden error messages
* typo fix
  • Loading branch information
Aptimex authored Jul 31, 2024
1 parent 5ce986d commit 5e80ca6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var addCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(addCmd)

addCmd.PersistentFlags().StringVarP(&addCmdArgs.endpoint, "endpoint", "e", addCmdArgs.endpoint, "socket address of wireguard listener; client address if inbound handshake and server address if outbound (example \"1.2.3.4:51820\")")
addCmd.PersistentFlags().StringVarP(&addCmdArgs.endpoint, "endpoint", "e", addCmdArgs.endpoint, "[REQUIRED] socket address of wireguard listener; client address if inbound handshake and server address if outbound (example \"1.2.3.4:51820\")")
addCmd.PersistentFlags().BoolVar(&addCmdArgs.outbound, "outbound", addCmdArgs.outbound, "use endpoint to initiate handshake out to server instead of the other way around")
addCmd.PersistentFlags().IntVarP(&addCmdArgs.port, "port", "p", addCmdArgs.port, "port of wireguard listener; client port if inbound handshake and server port if outbound")

Expand All @@ -48,7 +48,9 @@ func init() {
helpFunc := addCmd.HelpFunc()
addCmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
if !ShowHidden {
for _, f := range []string{"keepalive"} {
for _, f := range []string{
"keepalive",
} {
err := cmd.Flags().MarkHidden(f)
if err != nil {
fmt.Printf("Failed to hide flag %v: %v\n", f, err)
Expand Down
6 changes: 5 additions & 1 deletion src/cmd/add_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ func init() {
} {
err := cmd.Flags().MarkHidden(f)
if err != nil {
fmt.Printf("Failed to hide flag %v: %v\n", f, err)
if strings.HasSuffix(err.Error(), "does not exist") {
//add_server also runs this and complains about args it doesn't recognize
} else {
fmt.Printf("Failed to hide flag %v: %v\n", f, err)
}
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions src/cmd/add_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var addServerCmd = &cobra.Command{
func init() {
addCmd.AddCommand(addServerCmd)

addServerCmd.Flags().StringSliceVarP(&addServerCmdArgs.allowedIPs, "routes", "r", addServerCmdArgs.allowedIPs, "CIDR IP ranges that will be routed through wiretap")
addServerCmd.Flags().StringSliceVarP(&addServerCmdArgs.allowedIPs, "routes", "r", addServerCmdArgs.allowedIPs, "[REQUIRED] CIDR IP ranges that will be routed through wiretap")
addServerCmd.Flags().StringVarP(&addServerCmdArgs.serverAddress, "server-address", "s", addServerCmdArgs.serverAddress, "API address of server that new server will connect to, connects to client by default")
addServerCmd.Flags().StringVarP(&addServerCmdArgs.configFileRelay, "relay-input", "", addServerCmdArgs.configFileRelay, "filename of input relay config file")
addServerCmd.Flags().StringVarP(&addServerCmdArgs.configFileE2EE, "e2ee-input", "", addServerCmdArgs.configFileE2EE, "filename of input E2EE config file")
Expand All @@ -65,15 +65,18 @@ func init() {
addCmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
if !ShowHidden {
for _, f := range []string{
"relay-output",
"e2ee-output",
"relay-input",
"e2ee-input",
"server-output",
} {
err := cmd.Flags().MarkHidden(f)
if err != nil {
fmt.Printf("Failed to hide flag %v: %v\n", f, err)
if strings.HasSuffix(err.Error(), "does not exist") {
//add_client also runs this and complains about args it doesn't recognize
} else {
fmt.Printf("Failed to hide flag %v: %v\n", f, err)
}

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func init() {
cmd.Flags().StringVarP(&exposeCmd.protocol, "protocol", "p", exposeCmd.protocol, "Port protocol, tcp/udp")
cmd.Flags().BoolVarP(&exposeCmd.dynamic, "dynamic", "d", exposeCmd.dynamic, "Dynamic port forwarding, SOCKS proxy service opens on remote port")
cmd.PersistentFlags().StringVarP(&exposeCmd.serverAddr, "server-address", "s", exposeCmd.serverAddr, "API address of server that ports should be forwarded from, exposes service to all servers by default")
cmd.PersistentFlags().StringVarP(&exposeCmd.configFile, "config", "c", exposeCmd.configFile, "Config file needed when talking to all serves (the default)")
cmd.PersistentFlags().StringVarP(&exposeCmd.configFile, "config", "c", exposeCmd.configFile, "Config file needed when talking to all servers (the default)")

cmd.MarkFlagsMutuallyExclusive("dynamic", "local")

Expand Down
2 changes: 1 addition & 1 deletion src/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func GetNextPrefixesForPeers(peers []PeerConfig) []netip.Prefix {

// Add number to filename if it already exists.
func FindAvailableFilename(f string) string {
count := 2
count := 1
ext := filepath.Ext(f)
basename := strings.TrimSuffix(f, ext)
for {
Expand Down

0 comments on commit 5e80ca6

Please sign in to comment.