Skip to content

Commit

Permalink
removed the need to use port flag for protocols that do not have the …
Browse files Browse the repository at this point in the history
…notion of a port (eg. icmp)
  • Loading branch information
greenstatic committed Aug 17, 2018
1 parent 8b3f7b9 commit eecf0e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cmd/openspa-client/cmd/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ var requestCmd = &cobra.Command{
return
}

// Parse ports
if startPort == 0 {
log.Error("Port cannot be 0")
if !tools.PortCanBeZero(protocolByte) && startPort == 0 {
log.Error("Protocol requires port")
os.Exit(badPrameters)
return
}

// Parse ports
if endPort == 0 {
endPort = startPort
}
Expand Down Expand Up @@ -283,7 +283,7 @@ func init() {
requestCmd.Flags().StringVar(&echoIPv6Server, "echo-ipv6-server", ipresolver.DefaultEchoIpV6Server,
"The IPv6 Echo-IP server to use for automatic public IP discovery (can be a domain or IP address)")

requestCmd.MarkFlagRequired("port")
//requestCmd.MarkFlagRequired("port")

rootCmd.AddCommand(requestCmd)
}
Expand Down Expand Up @@ -399,6 +399,7 @@ func request(clientPrivKey *rsa.PrivateKey, clientPubKey *rsa.PublicKey, serverP
}

log.WithFields(log.Fields{
"protocol": tools.ConvertProtoByteToStr(resp.Payload.Protocol),
"startPort": resp.Payload.StartPort,
"endPort": resp.Payload.EndPort,
"duration": resp.Payload.Duration,
Expand Down
2 changes: 1 addition & 1 deletion internal/client/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "fmt"

const VersionMajor = 0
const VersionMinor = 1
const VersionBugfix = 0
const VersionBugfix = 1

var Version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionBugfix)
2 changes: 1 addition & 1 deletion internal/server/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "fmt"

const VersionMajor = 0
const VersionMinor = 1
const VersionBugfix = 0
const VersionBugfix = 1

var Version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionBugfix)

0 comments on commit eecf0e8

Please sign in to comment.