Skip to content

Commit

Permalink
add wrapper function DialWithTLSDialer to allow use of custom `net.…
Browse files Browse the repository at this point in the history
…Dialer` (#336)

Co-authored-by: John Weldon <[email protected]>
  • Loading branch information
Christopher Puschmann and johnweldon authored Aug 15, 2021
1 parent b09d2f3 commit a10e112
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ func DialWithTLSConfig(tc *tls.Config) DialOpt {
}
}

// DialWithTLSDialer is a wrapper for DialWithTLSConfig with the option to
// specify a net.Dialer to for example define a timeout or a custom resolver.
func DialWithTLSDialer(tlsConfig *tls.Config, dialer *net.Dialer) DialOpt {
return func(dc *DialContext) {
dc.tc = tlsConfig
dc.d = dialer
}
}

// DialContext contains necessary parameters to dial the given ldap URL.
type DialContext struct {
d *net.Dialer
Expand Down
9 changes: 9 additions & 0 deletions v3/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ func DialWithTLSConfig(tc *tls.Config) DialOpt {
}
}

// DialWithTLSDialer is a wrapper for DialWithTLSConfig with the option to
// specify a net.Dialer to for example define a timeout or a custom resolver.
func DialWithTLSDialer(tlsConfig *tls.Config, dialer *net.Dialer) DialOpt {
return func(dc *DialContext) {
dc.tc = tlsConfig
dc.d = dialer
}
}

// DialContext contains necessary parameters to dial the given ldap URL.
type DialContext struct {
d *net.Dialer
Expand Down

0 comments on commit a10e112

Please sign in to comment.