netsampler / goflow2

High performance sFlow/IPFIX/NetFlow Collector
BSD 3-Clause "New" or "Revised" License
487 stars 112 forks source link

fix: use net.JoinHostPort() to create listen address #316

Closed newgenid closed 6 months ago

newgenid commented 6 months ago

fmt.Sprintf("%s:%d", addr, port) works incorrect for ipv6 addr. net.JoinHostPort() supports ipv6 addresses and returns "[host]:port" Without this fix UDPReceiver does not work with ipv6 addresses.

lspgn commented 6 months ago

Thank you for your contribution but I will have to decline. This is not really a necessary change and requires to import another lib. Also please add a description.

newgenid commented 6 months ago

fmt.Sprintf("%s:%d", addr, port) works incorrect for ipv6 addr. net.JoinHostPort() supports ipv6 addresses and returns "[host]:port" Without this fix UDPReceiver does not work with ipv6 addresses.

About "and requires to import another lib". We can use fmt.Sprintf("%d", port) instead strconv.Itoa(port) if You want.

I created new pr 321. Please, review this.