From d7bab9a15d7291e1fc7ebf3b860db9cd73d4068a Mon Sep 17 00:00:00 2001 From: Mika Dede Date: Sun, 18 Jun 2023 06:15:17 +0200 Subject: [PATCH] rename tcptlc to tcptls --- client.go | 2 +- const.go | 2 +- setup.go | 2 +- transport.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 95b05c9..9475567 100644 --- a/client.go +++ b/client.go @@ -54,7 +54,7 @@ func NewClient(addr, net string) Client { // SetTLSConfig sets tls config for client func (c *client) SetTLSConfig(cfg *tls.Config) { if cfg != nil { - c.net = tcptlc + c.net = tcptls } c.transport.SetTLSConfig(cfg) } diff --git a/const.go b/const.go index fed0d37..27fcea5 100644 --- a/const.go +++ b/const.go @@ -26,7 +26,7 @@ const ( defaultTimeout = 30 * time.Second readTimeout = 2 * time.Second attemptDelay = time.Millisecond * 100 - tcptlc = "tcp-tls" + tcptls = "tcp-tls" tcp = "tcp" udp = "udp" ) diff --git a/setup.go b/setup.go index 50f2c6d..e37af15 100644 --- a/setup.go +++ b/setup.go @@ -263,7 +263,7 @@ func parseProtocol(f *Fanout, c *caddyfile.Dispenser) error { return c.ArgErr() } net := strings.ToLower(c.Val()) - if net != tcp && net != udp && net != tcptlc { + if net != tcp && net != udp && net != tcptls { return errors.New("unknown network protocol") } f.net = net diff --git a/transport.go b/transport.go index 2637eef..18dfdb8 100644 --- a/transport.go +++ b/transport.go @@ -51,9 +51,9 @@ func (t *transportImpl) SetTLSConfig(c *tls.Config) { // Dial dials the address configured in transportImpl, potentially reusing a connection or creating a new one. func (t *transportImpl) Dial(ctx context.Context, network string) (*dns.Conn, error) { if t.tlsConfig != nil { - network = tcptlc + network = tcptls } - if network == tcptlc { + if network == tcptls { return t.dial(ctx, &dns.Client{Net: network, Dialer: &net.Dialer{Timeout: maxTimeout}, TLSConfig: t.tlsConfig}) } return t.dial(ctx, &dns.Client{Net: network, Dialer: &net.Dialer{Timeout: maxTimeout}}) @@ -78,7 +78,7 @@ func (t *transportImpl) dial(ctx context.Context, c *dns.Client) (*dns.Conn, err } var conn = new(dns.Conn) var err error - if network == tcptlc { + if network == tcptls { conn.Conn, err = tls.DialWithDialer(&d, "tcp", t.addr, c.TLSConfig) } else { conn.Conn, err = d.DialContext(ctx, network, t.addr)