瀏覽代碼

Ensure that JSON marshaled TransferURLs omit empty fields

Rod Hynes 7 月之前
父節點
當前提交
710b65e5f1
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      psiphon/common/parameters/transferURLs.go

+ 4 - 4
psiphon/common/parameters/transferURLs.go

@@ -32,20 +32,20 @@ type TransferURL struct {
 
 
 	// URL is the location of the resource. This string is slightly obfuscated
 	// URL is the location of the resource. This string is slightly obfuscated
 	// with base64 encoding to mitigate trivial binary executable string scanning.
 	// with base64 encoding to mitigate trivial binary executable string scanning.
-	URL string
+	URL string `json:",omitempty"`
 
 
 	// SkipVerify indicates whether to verify HTTPS certificates. In some
 	// SkipVerify indicates whether to verify HTTPS certificates. In some
 	// circumvention scenarios, verification is not possible. This must
 	// circumvention scenarios, verification is not possible. This must
 	// only be set to true when the resource has its own verification mechanism.
 	// only be set to true when the resource has its own verification mechanism.
 	// Overridden when a FrontingSpec in FrontingSpecs has verification fields
 	// Overridden when a FrontingSpec in FrontingSpecs has verification fields
 	// set.
 	// set.
-	SkipVerify bool
+	SkipVerify bool `json:",omitempty"`
 
 
 	// OnlyAfterAttempts specifies how to schedule this URL when transferring
 	// OnlyAfterAttempts specifies how to schedule this URL when transferring
 	// the same resource (same entity, same ETag) from multiple different
 	// the same resource (same entity, same ETag) from multiple different
 	// candidate locations. For a value of N, this URL is only a candidate
 	// candidate locations. For a value of N, this URL is only a candidate
 	// after N rounds of attempting the transfer to or from other URLs.
 	// after N rounds of attempting the transfer to or from other URLs.
-	OnlyAfterAttempts int
+	OnlyAfterAttempts int `json:",omitempty"`
 
 
 	// B64EncodedPublicKey is a base64-encoded RSA public key to be used for
 	// B64EncodedPublicKey is a base64-encoded RSA public key to be used for
 	// encrypting the resource, when uploading, or for verifying a signature of
 	// encrypting the resource, when uploading, or for verifying a signature of
@@ -59,7 +59,7 @@ type TransferURL struct {
 
 
 	// FrontingSpecs is an optional set of domain fronting configurations to
 	// FrontingSpecs is an optional set of domain fronting configurations to
 	// apply to any requests made to the destination.
 	// apply to any requests made to the destination.
-	FrontingSpecs FrontingSpecs
+	FrontingSpecs FrontingSpecs `json:",omitempty"`
 }
 }
 
 
 // TransferURLs is a list of transfer URLs.
 // TransferURLs is a list of transfer URLs.