mirror of https://github.com/fluffle/goirc
Add net.Dialer DualStack config option.
This commit is contained in:
parent
a7abc67ac2
commit
fc1dfa1ceb
|
@ -82,6 +82,11 @@ type Config struct {
|
||||||
// Local address to bind to when connecting to the server.
|
// Local address to bind to when connecting to the server.
|
||||||
LocalAddr string
|
LocalAddr string
|
||||||
|
|
||||||
|
// To attempt RFC6555 parallel IPv4 and IPv6 connections if both
|
||||||
|
// address families are returned for a hostname, set this to true.
|
||||||
|
// Passed through to https://golang.org/pkg/net/#Dialer
|
||||||
|
DualStack bool
|
||||||
|
|
||||||
// Replaceable function to customise the 433 handler's new nick.
|
// Replaceable function to customise the 433 handler's new nick.
|
||||||
// By default an underscore "_" is appended to the current nick.
|
// By default an underscore "_" is appended to the current nick.
|
||||||
NewNick func(string) string
|
NewNick func(string) string
|
||||||
|
@ -160,6 +165,7 @@ func Client(cfg *Config) *Conn {
|
||||||
|
|
||||||
dialer := new(net.Dialer)
|
dialer := new(net.Dialer)
|
||||||
dialer.Timeout = cfg.Timeout
|
dialer.Timeout = cfg.Timeout
|
||||||
|
dialer.DualStack = cfg.DualStack
|
||||||
if cfg.LocalAddr != "" {
|
if cfg.LocalAddr != "" {
|
||||||
if !hasPort(cfg.LocalAddr) {
|
if !hasPort(cfg.LocalAddr) {
|
||||||
cfg.LocalAddr += ":0"
|
cfg.LocalAddr += ":0"
|
||||||
|
|
Loading…
Reference in New Issue