mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
Adds udp6 support for ingest servers (#1134)
with flag -enableUDP6 https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1131
This commit is contained in:
parent
0ce557951f
commit
18cfc4be7b
@ -44,7 +44,7 @@ func MustStart(addr string, insertHandler func(r io.Reader) error) *Server {
|
||||
}
|
||||
|
||||
logger.Infof("starting UDP Graphite server at %q", addr)
|
||||
lnUDP, err := net.ListenPacket("udp4", addr)
|
||||
lnUDP, err := net.ListenPacket(netutil.GetUDPNetwork(), addr)
|
||||
if err != nil {
|
||||
logger.Fatalf("cannot start UDP Graphite server at %q: %s", addr, err)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func MustStart(addr string, insertHandler func(r io.Reader) error) *Server {
|
||||
}
|
||||
|
||||
logger.Infof("starting UDP Influx server at %q", addr)
|
||||
lnUDP, err := net.ListenPacket("udp4", addr)
|
||||
lnUDP, err := net.ListenPacket(netutil.GetUDPNetwork(), addr)
|
||||
if err != nil {
|
||||
logger.Fatalf("cannot start UDP Influx server at %q: %s", addr, err)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func MustStart(addr string, telnetInsertHandler func(r io.Reader) error, httpIns
|
||||
httpServer := opentsdbhttp.MustServe(lnHTTP, httpInsertHandler)
|
||||
|
||||
logger.Infof("starting UDP OpenTSDB collector at %q", addr)
|
||||
lnUDP, err := net.ListenPacket("udp4", addr)
|
||||
lnUDP, err := net.ListenPacket(netutil.GetUDPNetwork(), addr)
|
||||
if err != nil {
|
||||
logger.Fatalf("cannot start UDP OpenTSDB collector at %q: %s", addr, err)
|
||||
}
|
||||
|
14
lib/netutil/udp.go
Normal file
14
lib/netutil/udp.go
Normal file
@ -0,0 +1,14 @@
|
||||
package netutil
|
||||
|
||||
import "flag"
|
||||
|
||||
var enableUDP6 = flag.Bool("enableUDP6", false, "Whether to enable IPv6 for listening. By default only IPv4 UDP is used")
|
||||
|
||||
// GetUDPNetwork returns current udp network.
|
||||
func GetUDPNetwork() string {
|
||||
if *enableUDP6 {
|
||||
// Enable both udp4 and udp6
|
||||
return "udp"
|
||||
}
|
||||
return "udp4"
|
||||
}
|
Loading…
Reference in New Issue
Block a user