but it seems like this happens before the custom libp2p.AddrFactory option is being applied on the libp2p host. I presume that NewAutorelay function is being passed a partially built instance of the basic host, which is probably due to some of the fx dependency injection magic.
In my custom AddrFactory option I add a public IP address that I discovery via STUN manually, and it's not being returned by calling host.Addrs() method unless I disable AutoRelay option.
In this line, autorelay overwrites the AddrFactory on the basic host: https://github.com/libp2p/go-libp2p/blob/921cc71072229344a78c7d794e3571c3cbf058e3/p2p/host/autorelay/autorelay.go#L54
It supposedly "caches" the original AddrFactory here: https://github.com/libp2p/go-libp2p/blob/921cc71072229344a78c7d794e3571c3cbf058e3/p2p/host/autorelay/autorelay.go#L41
but it seems like this happens before the custom
libp2p.AddrFactory
option is being applied on the libp2p host. I presume thatNewAutorelay
function is being passed a partially built instance of the basic host, which is probably due to some of thefx
dependency injection magic.In my custom AddrFactory option I add a public IP address that I discovery via STUN manually, and it's not being returned by calling
host.Addrs()
method unless I disable AutoRelay option.