Skip to content

Commit

Permalink
rename tcptlc to tcptls
Browse files Browse the repository at this point in the history
Signed-off-by: Mika Dede <[email protected]>
  • Loading branch information
xervon committed Aug 19, 2024
1 parent 739abe1 commit c10fd2a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}})
Expand All @@ -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)
Expand Down

0 comments on commit c10fd2a

Please sign in to comment.