Commit fe415aed authored by Jeromy's avatar Jeromy

expose transport parameter to swarm creation

parent 388f3c19
...@@ -105,12 +105,12 @@ type Swarm struct { ...@@ -105,12 +105,12 @@ type Swarm struct {
func NewSwarm(ctx context.Context, listenAddrs []ma.Multiaddr, local peer.ID, func NewSwarm(ctx context.Context, listenAddrs []ma.Multiaddr, local peer.ID,
peers pstore.Peerstore, bwc metrics.Reporter) (*Swarm, error) { peers pstore.Peerstore, bwc metrics.Reporter) (*Swarm, error) {
return NewSwarmWithProtector(ctx, listenAddrs, local, peers, nil, bwc) return NewSwarmWithProtector(ctx, listenAddrs, local, peers, nil, PSTransport, bwc)
} }
// NewSwarm constructs a Swarm, with a Chan. // NewSwarm constructs a Swarm, with a Chan.
func NewSwarmWithProtector(ctx context.Context, listenAddrs []ma.Multiaddr, local peer.ID, func NewSwarmWithProtector(ctx context.Context, listenAddrs []ma.Multiaddr, local peer.ID,
peers pstore.Peerstore, protec ipnet.Protector, bwc metrics.Reporter) (*Swarm, error) { peers pstore.Peerstore, protec ipnet.Protector, tpt pst.Transport, bwc metrics.Reporter) (*Swarm, error) {
listenAddrs, err := filterAddrs(listenAddrs) listenAddrs, err := filterAddrs(listenAddrs)
if err != nil { if err != nil {
...@@ -125,7 +125,7 @@ func NewSwarmWithProtector(ctx context.Context, listenAddrs []ma.Multiaddr, loca ...@@ -125,7 +125,7 @@ func NewSwarmWithProtector(ctx context.Context, listenAddrs []ma.Multiaddr, loca
} }
s := &Swarm{ s := &Swarm{
swarm: ps.NewSwarm(PSTransport), swarm: ps.NewSwarm(tpt),
local: local, local: local,
peers: peers, peers: peers,
ctx: ctx, ctx: ctx,
......
...@@ -28,7 +28,7 @@ func NewNetwork(ctx context.Context, listen []ma.Multiaddr, local peer.ID, ...@@ -28,7 +28,7 @@ func NewNetwork(ctx context.Context, listen []ma.Multiaddr, local peer.ID,
func NewNetworkWithProtector(ctx context.Context, listen []ma.Multiaddr, local peer.ID, func NewNetworkWithProtector(ctx context.Context, listen []ma.Multiaddr, local peer.ID,
peers pstore.Peerstore, protec ipnet.Protector, bwc metrics.Reporter) (*Network, error) { peers pstore.Peerstore, protec ipnet.Protector, bwc metrics.Reporter) (*Network, error) {
s, err := NewSwarmWithProtector(ctx, listen, local, peers, protec, bwc) s, err := NewSwarmWithProtector(ctx, listen, local, peers, protec, PSTransport, bwc)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment