mirror of https://github.com/ginuerzh/gost
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
425 B
23 lines
425 B
package gost
|
|
|
|
import (
|
|
"context"
|
|
"crypto/tls"
|
|
"net"
|
|
)
|
|
|
|
type tlsTransporter struct {
|
|
TLSClientConfig *tls.Config
|
|
}
|
|
|
|
func TLSTransporter(cfg *tls.Config) Transporter {
|
|
return &tlsTransporter{TLSClientConfig: cfg}
|
|
}
|
|
|
|
func (tr *tlsTransporter) Network() string {
|
|
return "tcp"
|
|
}
|
|
|
|
func (tr *tlsTransporter) Handshake(ctx context.Context, conn net.Conn) (net.Conn, error) {
|
|
return tls.Client(conn, tr.TLSClientConfig), nil
|
|
}
|
|
|