26 lines
440 B
Go
26 lines
440 B
Go
package tcp_tls
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"io"
|
|
"net"
|
|
"time"
|
|
|
|
"git.loafle.net/commons_go/server"
|
|
)
|
|
|
|
type ClientHandlers struct {
|
|
server.ClientHandlers
|
|
|
|
tlsConfig *tls.Config
|
|
}
|
|
|
|
func (ch *ClientHandlers) Dial() (conn io.ReadWriteCloser, err error) {
|
|
dialer := &net.Dialer{
|
|
Timeout: ch.RequestTimeout * time.Second,
|
|
KeepAlive: ch.KeepAlivePeriod * time.Second,
|
|
}
|
|
|
|
return tls.DialWithDialer(dialer, "tcp", ch.Addr, ch.tlsConfig)
|
|
}
|