1
0
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:
源文雨
2025-12-21 16:51:38 +08:00
parent 0d2a7a0385
commit f99b9330df
23 changed files with 1195 additions and 18 deletions

View File

@@ -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

View File

@@ -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