diff --git a/core/corehttp/proxy.go b/core/corehttp/proxy.go index 89d0affd6..6c3b793d2 100644 --- a/core/corehttp/proxy.go +++ b/core/corehttp/proxy.go @@ -33,7 +33,7 @@ func ProxyOption() ServeOption { return } - rt := p2phttp.NewTransport(ipfsNode.P2P.PeerHost, p2phttp.ProtocolOption(parsedRequest.name)) + rt := p2phttp.NewTransport(ipfsNode.PeerHost, p2phttp.ProtocolOption(parsedRequest.name)) proxy := httputil.NewSingleHostReverseProxy(target) proxy.Transport = rt proxy.ServeHTTP(w, request) diff --git a/p2p/local.go b/p2p/local.go index 076af3bc4..47c7a312b 100644 --- a/p2p/local.go +++ b/p2p/local.go @@ -55,7 +55,7 @@ func (l *localListener) dial(ctx context.Context) (net.Stream, error) { cctx, cancel := context.WithTimeout(ctx, time.Second*30) //TODO: configurable? defer cancel() - return l.p2p.PeerHost.NewStream(cctx, l.peer, l.proto) + return l.p2p.peerHost.NewStream(cctx, l.peer, l.proto) } func (l *localListener) acceptConns() { diff --git a/p2p/p2p.go b/p2p/p2p.go index 2d8ee8ca4..efc87f722 100644 --- a/p2p/p2p.go +++ b/p2p/p2p.go @@ -16,23 +16,23 @@ type P2P struct { Streams *StreamRegistry identity peer.ID - PeerHost p2phost.Host + peerHost p2phost.Host peerstore pstore.Peerstore } // NewP2P creates new P2P struct -func NewP2P(identity peer.ID, PeerHost p2phost.Host, peerstore pstore.Peerstore) *P2P { +func NewP2P(identity peer.ID, peerHost p2phost.Host, peerstore pstore.Peerstore) *P2P { return &P2P{ identity: identity, - PeerHost: PeerHost, + peerHost: peerHost, peerstore: peerstore, ListenersLocal: newListenersLocal(), - ListenersP2P: newListenersP2P(PeerHost), + ListenersP2P: newListenersP2P(peerHost), Streams: &StreamRegistry{ Streams: map[uint64]*Stream{}, - ConnManager: PeerHost.ConnManager(), + ConnManager: peerHost.ConnManager(), conns: map[peer.ID]int{}, }, } @@ -41,7 +41,7 @@ func NewP2P(identity peer.ID, PeerHost p2phost.Host, peerstore pstore.Peerstore) // CheckProtoExists checks whether a proto handler is registered to // mux handler func (p2p *P2P) CheckProtoExists(proto string) bool { - protos := p2p.PeerHost.Mux().Protocols() + protos := p2p.peerHost.Mux().Protocols() for _, p := range protos { if p != proto {