mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-20 10:40:28 +08:00
feat: embed terasu inside
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/fumiama/terasu"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
@@ -87,7 +88,7 @@ func (d *OriginDialerService) DialTCP(ctx context.Context, addr netip.AddrPort)
|
||||
}
|
||||
// Assign the write timeout for the TCP operations
|
||||
return &tcpConnection{
|
||||
Conn: conn,
|
||||
Conn: terasu.NewConn(conn),
|
||||
writeTimeout: d.writeTimeout,
|
||||
logger: d.logger,
|
||||
}, nil
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/fumiama/terasu"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
@@ -64,6 +65,9 @@ func (o *httpService) SetOriginServerName(req *http.Request) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tc, ok := conn.(*net.TCPConn); ok {
|
||||
conn = terasu.NewConn(tc)
|
||||
}
|
||||
return tls.Client(conn, &tls.Config{
|
||||
RootCAs: o.transport.TLSClientConfig.RootCAs,
|
||||
InsecureSkipVerify: o.transport.TLSClientConfig.InsecureSkipVerify, // nolint: gosec
|
||||
|
||||
Reference in New Issue
Block a user