feat: return tcp.Address from listener, if exists (#336)

* This is the more accurate and correct address of the listener
* Useful if you want to listen on port 0 to dynamically create
listeners (think of unit/integration tests)

Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
This commit is contained in:
Aaron France
2023-12-22 00:59:51 +01:00
committed by GitHub
parent c6c7c296f6
commit 5523d15a9b

View File

@@ -44,6 +44,9 @@ func (l *TCP) ID() string {
// Address returns the address of the listener.
func (l *TCP) Address() string {
if l.listen != nil {
return l.listen.Addr().String()
}
return l.address
}