absent forwarding ports omit JSON field

This commit is contained in:
TechHutTV
2026-05-19 16:36:36 -07:00
parent d3293fb282
commit fd0834441d
2 changed files with 31 additions and 13 deletions
+8 -5
View File
@@ -473,12 +473,15 @@ func (o *NetworksListOutput) YAML() (string, error) {
}
// ForwardingRuleOutput is one row of a forwarding-list response.
// DestinationPort and TranslatedPort are pointers so that absent port info
// (oneof not set in the protobuf) surfaces as a missing field rather than a
// human-readable sentinel string.
type ForwardingRuleOutput struct {
TranslatedAddress string `json:"translatedAddress" yaml:"translatedAddress"`
TranslatedHostname string `json:"translatedHostname,omitempty" yaml:"translatedHostname,omitempty"`
Protocol string `json:"protocol" yaml:"protocol"`
DestinationPort string `json:"destinationPort" yaml:"destinationPort"`
TranslatedPort string `json:"translatedPort" yaml:"translatedPort"`
TranslatedAddress string `json:"translatedAddress" yaml:"translatedAddress"`
TranslatedHostname string `json:"translatedHostname,omitempty" yaml:"translatedHostname,omitempty"`
Protocol string `json:"protocol" yaml:"protocol"`
DestinationPort *string `json:"destinationPort,omitempty" yaml:"destinationPort,omitempty"`
TranslatedPort *string `json:"translatedPort,omitempty" yaml:"translatedPort,omitempty"`
}
// ForwardingListOutput is the structured result of `netbird forwarding list`.