Client config param added to specify net iface to use for fingerprinting. Added a Golang-native method for determining the interface IP address.

This commit is contained in:
Antoine POPINEAU
2015-10-01 17:31:47 +02:00
parent 6adc958a27
commit 7fc3f83672
4 changed files with 61 additions and 1 deletions

View File

@@ -192,6 +192,9 @@ func (a *Agent) setupClient() error {
conf.AllocDir = a.config.Client.AllocDir
}
conf.Servers = a.config.Client.Servers
if a.config.Client.Iface != "" {
conf.Iface = a.config.Client.Iface
}
// Setup the node
conf.Node = new(structs.Node)

View File

@@ -139,6 +139,9 @@ type ClientConfig struct {
// Metadata associated with the node
Meta map[string]string `hcl:"meta"`
// Interface to use for network fingerprinting
Iface string `hcl:"iface"`
}
// ServerConfig is configuration specific to the server mode
@@ -384,6 +387,9 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
if b.NodeClass != "" {
result.NodeClass = b.NodeClass
}
if b.Iface != "" {
result.Iface = b.Iface
}
// Add the servers
result.Servers = append(result.Servers, b.Servers...)