mirror of
https://github.com/mochi-mqtt/server.git
synced 2025-09-26 20:21:12 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user