-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send version info to rendezvous server.
Include agent string and version when binding to the rendezvous server. There's default values that can be overridden using WithVersion() when instantiating the rendezvous client. Fixes: #2
- Loading branch information
Showing
6 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package rendezvous | ||
|
||
type ClientOption interface { | ||
setValue(*Client) | ||
} | ||
|
||
type versionOption struct { | ||
agentString string | ||
agentVersion string | ||
} | ||
|
||
func (o *versionOption) setValue(c *Client) { | ||
c.agentString = o.agentString | ||
c.agentVersion = o.agentVersion | ||
} | ||
|
||
// WithVersion returns a ClientOption to override the default client | ||
// identifier and version reported to the rendezvous server. | ||
func WithVersion(agentID string, version string) ClientOption { | ||
return &versionOption{ | ||
agentString: agentID, | ||
agentVersion: version, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package version | ||
|
||
var ( | ||
// Default Agent identifier sent to rendezvous server | ||
AgentString = "go-william" | ||
// Default Agent version sent to rendezvous server | ||
AgentVersion = "v1.0.0" | ||
) |