Browse Source
feat(websocket): switch the underlying http server logger to use ipfs/go-log (#2985)
fix/re-enable-ws-transport-tests
Adin Schmahmann
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
2 deletions
-
go.mod
-
p2p/transport/websocket/listener.go
|
|
@ -60,6 +60,7 @@ require ( |
|
|
|
go.uber.org/fx v1.22.1 |
|
|
|
go.uber.org/goleak v1.3.0 |
|
|
|
go.uber.org/mock v0.4.0 |
|
|
|
go.uber.org/zap v1.27.0 |
|
|
|
golang.org/x/crypto v0.25.0 |
|
|
|
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 |
|
|
|
golang.org/x/sync v0.7.0 |
|
|
@ -123,7 +124,6 @@ require ( |
|
|
|
github.com/wlynxg/anet v0.0.3 // indirect |
|
|
|
go.uber.org/dig v1.17.1 // indirect |
|
|
|
go.uber.org/multierr v1.11.0 // indirect |
|
|
|
go.uber.org/zap v1.27.0 // indirect |
|
|
|
golang.org/x/mod v0.19.0 // indirect |
|
|
|
golang.org/x/net v0.27.0 // indirect |
|
|
|
golang.org/x/text v0.16.0 // indirect |
|
|
|
|
|
@ -4,16 +4,22 @@ import ( |
|
|
|
"crypto/tls" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"go.uber.org/zap" |
|
|
|
"net" |
|
|
|
"net/http" |
|
|
|
"sync" |
|
|
|
|
|
|
|
logging "github.com/ipfs/go-log/v2" |
|
|
|
|
|
|
|
"github.com/libp2p/go-libp2p/core/transport" |
|
|
|
|
|
|
|
ma "github.com/multiformats/go-multiaddr" |
|
|
|
manet "github.com/multiformats/go-multiaddr/net" |
|
|
|
) |
|
|
|
|
|
|
|
var log = logging.Logger("websocket-transport") |
|
|
|
var stdLog = zap.NewStdLog(log.Desugar()) |
|
|
|
|
|
|
|
type listener struct { |
|
|
|
nl net.Listener |
|
|
|
server http.Server |
|
|
@ -82,7 +88,7 @@ func newListener(a ma.Multiaddr, tlsConf *tls.Config) (*listener, error) { |
|
|
|
incoming: make(chan *Conn), |
|
|
|
closed: make(chan struct{}), |
|
|
|
} |
|
|
|
ln.server = http.Server{Handler: ln} |
|
|
|
ln.server = http.Server{Handler: ln, ErrorLog: stdLog} |
|
|
|
if parsed.isWSS { |
|
|
|
ln.isWss = true |
|
|
|
ln.server.TLSConfig = tlsConf |
|
|
|