common
common copied to clipboard
Provide function for finding address of interface used in outgoing connections
I'm working on instrumenting go services so they may make Zipkin aware of their location and found (through this SO answer) this way for fetching service IP.
I saw there's already a function for getting address given an interface: https://github.com/weaveworks/common/blob/955c13089be4f5ee948aeca47af832d23e4bc394/network/interface.go#L9
I guess services will almost (?) always make use of eth0 interface but it seems to me that getting the address without fixing it for a given interface is a more robust way of finding service IP.
If so, shall we provide this, for instance, GetOutboundIP function in weaveworks/commons?