From b5a2ce94353a163de8f20b8e58767f711c722af3 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 22 Jan 2020 15:33:41 +0530 Subject: [PATCH 01/32] host changes for introspection --- config/config.go | 25 +++++++++--- options.go | 23 +++++++++++ p2p/host/basic/basic_host.go | 76 ++++++++++++++++++++++++++++++------ 3 files changed, 106 insertions(+), 18 deletions(-) diff --git a/config/config.go b/config/config.go index 2ace430a49..7acd9c985a 100644 --- a/config/config.go +++ b/config/config.go @@ -7,6 +7,7 @@ import ( "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/host" + coreit "github.com/libp2p/go-libp2p-core/introspection" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" @@ -14,6 +15,7 @@ import ( "github.com/libp2p/go-libp2p-core/pnet" "github.com/libp2p/go-libp2p-core/routing" + "github.com/libp2p/go-libp2p-introspection/introspection" bhost "github.com/libp2p/go-libp2p/p2p/host/basic" relay "github.com/libp2p/go-libp2p/p2p/host/relay" routed "github.com/libp2p/go-libp2p/p2p/host/routed" @@ -77,6 +79,9 @@ type Config struct { EnableAutoRelay bool StaticRelays []peer.AddrInfo + + Introspector coreit.Introspector + IntrospectionServerAddr string } // NewNode constructs a new libp2p Host from the Config. @@ -114,18 +119,25 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { return nil, err } + introspector := cfg.Introspector + if introspector == nil { + introspector = introspection.NewDefaultIntrospector() + } + // TODO: Make the swarm implementation configurable. - swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter) + swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter, introspector) if cfg.Filters != nil { swrm.Filters = cfg.Filters } h, err := bhost.NewHost(ctx, swrm, &bhost.HostOpts{ - ConnManager: cfg.ConnManager, - AddrsFactory: cfg.AddrsFactory, - NATManager: cfg.NATManager, - EnablePing: !cfg.DisablePing, - UserAgent: cfg.UserAgent, + ConnManager: cfg.ConnManager, + AddrsFactory: cfg.AddrsFactory, + NATManager: cfg.NATManager, + EnablePing: !cfg.DisablePing, + UserAgent: cfg.UserAgent, + Introspector: introspector, + IntrospectionServerAddr: cfg.IntrospectionServerAddr, }) if err != nil { @@ -242,6 +254,7 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { if router != nil { return routed.Wrap(h, router), nil } + return h, nil } diff --git a/options.go b/options.go index b46c466d4c..bf68d5dfec 100644 --- a/options.go +++ b/options.go @@ -5,6 +5,7 @@ package libp2p import ( "fmt" + coreit "github.com/libp2p/go-libp2p-core/introspection" "net" "github.com/libp2p/go-libp2p-core/connmgr" @@ -193,6 +194,28 @@ func ConnectionManager(connman connmgr.ConnManager) Option { } } +// Introspector configures the host to use the given introspector +func Introspector(i coreit.Introspector) Option { + return func(cfg *Config) error { + if cfg.Introspector != nil { + return fmt.Errorf("cannot specify multiple introspectors") + } + cfg.Introspector = i + return nil + } +} + +// IntrospectionServerAddr configures the address for the introspection server +func IntrospectionServerAddr(addr string) Option { + return func(cfg *Config) error { + if len(cfg.IntrospectionServerAddr) != 0 { + return fmt.Errorf("cannot specify multiple introspection server addresses") + } + cfg.IntrospectionServerAddr = addr + return nil + } +} + // AddrsFactory configures libp2p to use the given address factory. func AddrsFactory(factory config.AddrsFactory) Option { return func(cfg *Config) error { diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index f8bf279cff..ed7ae2002b 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -4,21 +4,23 @@ import ( "context" "io" "net" + runtime2 "runtime" "sync" "time" + "github.com/libp2p/go-libp2p-introspection/introspection" "github.com/libp2p/go-libp2p/p2p/protocol/identify" "github.com/libp2p/go-libp2p/p2p/protocol/ping" "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/event" "github.com/libp2p/go-libp2p-core/host" + coreit "github.com/libp2p/go-libp2p-core/introspection" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" "github.com/libp2p/go-libp2p-core/protocol" - "github.com/libp2p/go-eventbus" inat "github.com/libp2p/go-libp2p-nat" logging "github.com/ipfs/go-log" @@ -35,6 +37,8 @@ import ( // peer (for all addresses). const maxAddressResolution = 32 +var _ coreit.IntrospectorRegistry = (*BasicHost)(nil) + var log = logging.Logger("basichost") var ( @@ -89,6 +93,9 @@ type BasicHost struct { emitters struct { evtLocalProtocolsUpdated event.Emitter } + + // introspector is the host introspector used to register subsystem metric providers & fetch the current system state when asked + introspector coreit.Introspector } var _ host.Host = (*BasicHost)(nil) @@ -124,6 +131,12 @@ type HostOpts struct { // UserAgent sets the user-agent for the host. Defaults to ClientVersion. UserAgent string + + // Introspector is used by host subsystems to register themselves as metrics providers & fetch the current state. + Introspector coreit.Introspector + + // IntrospectionServerAddr is the address for the introspection server + IntrospectionServerAddr string } // NewHost constructs a new *BasicHost and activates it by attaching its stream and connection handlers to the given inet.Network. @@ -135,6 +148,7 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo AddrsFactory: DefaultAddrsFactory, maResolver: madns.DefaultResolver, eventbus: eventbus.NewBus(), + introspector: opts.Introspector, } var err error @@ -142,17 +156,6 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo return nil, err } - h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { - if h.natmgr != nil { - h.natmgr.Close() - } - if h.cmgr != nil { - h.cmgr.Close() - } - _ = h.emitters.evtLocalProtocolsUpdated.Close() - return h.Network().Close() - }) - if opts.MultistreamMuxer != nil { h.mux = opts.MultistreamMuxer } @@ -191,12 +194,54 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo h.pings = ping.NewPingService(h) } + if h.introspector == nil { + h.introspector = introspection.NewDefaultIntrospector() + } + net.SetConnHandler(h.newConnHandler) net.SetStreamHandler(h.newStreamHandler) + // register runtime provider + if err := h.introspector.RegisterProviders(&coreit.ProvidersTree{Runtime: h.runtimeDataProvider()}); err != nil { + log.Errorf("failed to register a runtime provider, err=%s", err) + } + + // start introspection server + // TODO What happens if address is not configured or not available ? + // TODO How do we configure a "default address" + shutDownFnc := introspection.StartServer(opts.IntrospectionServerAddr, h.introspector) + + h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { + if h.natmgr != nil { + h.natmgr.Close() + } + if h.cmgr != nil { + h.cmgr.Close() + } + _ = h.emitters.evtLocalProtocolsUpdated.Close() + + if err := shutDownFnc(); err != nil { + log.Errorf("error while shutting down introspection server, err=%s", err) + } + + return h.Network().Close() + }) + return h, nil } +func (h *BasicHost) runtimeDataProvider() *coreit.RuntimeProviders { + // TODO What is the version here ? + runtime := &coreit.Runtime{Implementation: "go-libp2p", + Platform: runtime2.GOOS, + PeerId: h.ID().Pretty(), + } + + return &coreit.RuntimeProviders{Get: func() (*coreit.Runtime, error) { + return runtime, nil + }} +} + // New constructs and sets up a new *BasicHost with given Network and options. // The following options can be passed: // * NATPortMap @@ -783,6 +828,13 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr { return dedupAddrs(finalAddrs) } +// TODO Do this for routed & relay hosts as well +// RegisterProvider allows the host to be an IntrospectorRegistry. Please look at the docs for the IntrospectorRegistry +// interface in go-libp2p-core for more details. +func (h *BasicHost) RegisterProviders(p *coreit.ProvidersTree) error { + return h.introspector.RegisterProviders(p) +} + // Close shuts down the Host's services (network, etc). func (h *BasicHost) Close() error { // You're thinking of adding some teardown logic here, right? Well From ece88530ecbb1a53db1dfd6ddd7f04a88241c749 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 24 Jan 2020 10:27:34 +0530 Subject: [PATCH 02/32] changes as per review --- config/config.go | 6 ++---- go.sum | 1 + p2p/host/basic/basic_host.go | 40 ++++++++++++------------------------ 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/config/config.go b/config/config.go index 7acd9c985a..621c302567 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,7 @@ import ( "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/host" - coreit "github.com/libp2p/go-libp2p-core/introspection" + "github.com/libp2p/go-libp2p-core/introspect" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" @@ -80,8 +80,7 @@ type Config struct { EnableAutoRelay bool StaticRelays []peer.AddrInfo - Introspector coreit.Introspector - IntrospectionServerAddr string + Introspector introspect.Introspector } // NewNode constructs a new libp2p Host from the Config. @@ -137,7 +136,6 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { EnablePing: !cfg.DisablePing, UserAgent: cfg.UserAgent, Introspector: introspector, - IntrospectionServerAddr: cfg.IntrospectionServerAddr, }) if err != nil { diff --git a/go.sum b/go.sum index e1b2cb45de..2e6e8bee0e 100644 --- a/go.sum +++ b/go.sum @@ -158,6 +158,7 @@ github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= +github.com/libp2p/go-libp2p-introspection v0.0.0-20200123110920-ee44b5738886 h1:aCvSYZQ487Xt/ELd6QM4J/Qws5jGy0DmrHwJIUMGi40= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index ed7ae2002b..20d5261322 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -15,7 +15,7 @@ import ( "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/event" "github.com/libp2p/go-libp2p-core/host" - coreit "github.com/libp2p/go-libp2p-core/introspection" + "github.com/libp2p/go-libp2p-core/introspect" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" @@ -37,7 +37,7 @@ import ( // peer (for all addresses). const maxAddressResolution = 32 -var _ coreit.IntrospectorRegistry = (*BasicHost)(nil) +var _ host.IntrospectableHost = (*BasicHost)(nil) var log = logging.Logger("basichost") @@ -94,8 +94,7 @@ type BasicHost struct { evtLocalProtocolsUpdated event.Emitter } - // introspector is the host introspector used to register subsystem metric providers & fetch the current system state when asked - introspector coreit.Introspector + introspector introspect.Introspector } var _ host.Host = (*BasicHost)(nil) @@ -133,10 +132,7 @@ type HostOpts struct { UserAgent string // Introspector is used by host subsystems to register themselves as metrics providers & fetch the current state. - Introspector coreit.Introspector - - // IntrospectionServerAddr is the address for the introspection server - IntrospectionServerAddr string + Introspector introspect.Introspector } // NewHost constructs a new *BasicHost and activates it by attaching its stream and connection handlers to the given inet.Network. @@ -202,14 +198,19 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo net.SetStreamHandler(h.newStreamHandler) // register runtime provider - if err := h.introspector.RegisterProviders(&coreit.ProvidersTree{Runtime: h.runtimeDataProvider()}); err != nil { + if err := h.introspector.RegisterProviders(&introspect.ProvidersMap{Runtime: func() (*introspect.Runtime, error) { + return &introspect.Runtime{Implementation: "go-libp2p", + Platform: runtime2.GOOS, + PeerId: h.ID().Pretty(), + }, nil + }}); err != nil { log.Errorf("failed to register a runtime provider, err=%s", err) } // start introspection server // TODO What happens if address is not configured or not available ? // TODO How do we configure a "default address" - shutDownFnc := introspection.StartServer(opts.IntrospectionServerAddr, h.introspector) + shutDownFnc := introspection.StartServer(h.introspector) h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { if h.natmgr != nil { @@ -230,16 +231,8 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo return h, nil } -func (h *BasicHost) runtimeDataProvider() *coreit.RuntimeProviders { - // TODO What is the version here ? - runtime := &coreit.Runtime{Implementation: "go-libp2p", - Platform: runtime2.GOOS, - PeerId: h.ID().Pretty(), - } - - return &coreit.RuntimeProviders{Get: func() (*coreit.Runtime, error) { - return runtime, nil - }} +func (h *BasicHost) Introspector() introspect.Introspector { + return h.introspector } // New constructs and sets up a new *BasicHost with given Network and options. @@ -828,13 +821,6 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr { return dedupAddrs(finalAddrs) } -// TODO Do this for routed & relay hosts as well -// RegisterProvider allows the host to be an IntrospectorRegistry. Please look at the docs for the IntrospectorRegistry -// interface in go-libp2p-core for more details. -func (h *BasicHost) RegisterProviders(p *coreit.ProvidersTree) error { - return h.introspector.RegisterProviders(p) -} - // Close shuts down the Host's services (network, etc). func (h *BasicHost) Close() error { // You're thinking of adding some teardown logic here, right? Well From ab66df8f8e5dafc7e32265422d136104fe72f9c5 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 24 Jan 2020 11:49:46 +0530 Subject: [PATCH 03/32] changes as per review --- config/config.go | 12 ++++++------ options.go | 15 ++------------- p2p/host/basic/basic_host.go | 7 ++++--- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/config/config.go b/config/config.go index 621c302567..66e1d10cf9 100644 --- a/config/config.go +++ b/config/config.go @@ -130,12 +130,12 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { } h, err := bhost.NewHost(ctx, swrm, &bhost.HostOpts{ - ConnManager: cfg.ConnManager, - AddrsFactory: cfg.AddrsFactory, - NATManager: cfg.NATManager, - EnablePing: !cfg.DisablePing, - UserAgent: cfg.UserAgent, - Introspector: introspector, + ConnManager: cfg.ConnManager, + AddrsFactory: cfg.AddrsFactory, + NATManager: cfg.NATManager, + EnablePing: !cfg.DisablePing, + UserAgent: cfg.UserAgent, + Introspector: introspector, }) if err != nil { diff --git a/options.go b/options.go index bf68d5dfec..52b5f79059 100644 --- a/options.go +++ b/options.go @@ -5,11 +5,11 @@ package libp2p import ( "fmt" - coreit "github.com/libp2p/go-libp2p-core/introspection" "net" "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" + "github.com/libp2p/go-libp2p-core/introspect" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" @@ -195,7 +195,7 @@ func ConnectionManager(connman connmgr.ConnManager) Option { } // Introspector configures the host to use the given introspector -func Introspector(i coreit.Introspector) Option { +func Introspector(i introspect.Introspector) Option { return func(cfg *Config) error { if cfg.Introspector != nil { return fmt.Errorf("cannot specify multiple introspectors") @@ -205,17 +205,6 @@ func Introspector(i coreit.Introspector) Option { } } -// IntrospectionServerAddr configures the address for the introspection server -func IntrospectionServerAddr(addr string) Option { - return func(cfg *Config) error { - if len(cfg.IntrospectionServerAddr) != 0 { - return fmt.Errorf("cannot specify multiple introspection server addresses") - } - cfg.IntrospectionServerAddr = addr - return nil - } -} - // AddrsFactory configures libp2p to use the given address factory. func AddrsFactory(factory config.AddrsFactory) Option { return func(cfg *Config) error { diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 20d5261322..95815056cb 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -197,20 +197,21 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo net.SetConnHandler(h.newConnHandler) net.SetStreamHandler(h.newStreamHandler) + // TODO What is Version ? // register runtime provider if err := h.introspector.RegisterProviders(&introspect.ProvidersMap{Runtime: func() (*introspect.Runtime, error) { return &introspect.Runtime{Implementation: "go-libp2p", Platform: runtime2.GOOS, PeerId: h.ID().Pretty(), + Version: "", }, nil }}); err != nil { log.Errorf("failed to register a runtime provider, err=%s", err) } + // TODO Resolve the discussion on address // start introspection server - // TODO What happens if address is not configured or not available ? - // TODO How do we configure a "default address" - shutDownFnc := introspection.StartServer(h.introspector) + shutDownFnc := introspection.StartServer("address", h.introspector) h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { if h.natmgr != nil { From 1690b408c8098c6fa997ae22dcca4a51d4719b62 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Tue, 28 Jan 2020 15:46:10 +0530 Subject: [PATCH 04/32] fix import issue --- p2p/host/basic/basic_host.go | 1 + 1 file changed, 1 insertion(+) diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 95815056cb..13727fe420 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -21,6 +21,7 @@ import ( "github.com/libp2p/go-libp2p-core/peerstore" "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-eventbus" inat "github.com/libp2p/go-libp2p-nat" logging "github.com/ipfs/go-log" From 0903bf8dafbaddc30a20b70cf39174d1a6976915 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Tue, 28 Jan 2020 15:51:04 +0530 Subject: [PATCH 05/32] fix nil error in host --- p2p/host/basic/basic_host.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 13727fe420..39f3514c32 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -157,13 +157,6 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo h.mux = opts.MultistreamMuxer } - // we can't set this as a default above because it depends on the *BasicHost. - h.ids = identify.NewIDService( - goprocessctx.WithProcessClosing(ctx, h.proc), - h, - identify.UserAgent(opts.UserAgent), - ) - if uint64(opts.NegotiationTimeout) != 0 { h.negtimeout = opts.NegotiationTimeout } @@ -212,7 +205,7 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo // TODO Resolve the discussion on address // start introspection server - shutDownFnc := introspection.StartServer("address", h.introspector) + introspectClose := introspection.StartServer("address", h.introspector) h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { if h.natmgr != nil { @@ -223,13 +216,20 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo } _ = h.emitters.evtLocalProtocolsUpdated.Close() - if err := shutDownFnc(); err != nil { + if err := introspectClose(); err != nil { log.Errorf("error while shutting down introspection server, err=%s", err) } return h.Network().Close() }) + // we can't set this as a default above because it depends on the *BasicHost. + h.ids = identify.NewIDService( + goprocessctx.WithProcessClosing(ctx, h.proc), + h, + identify.UserAgent(opts.UserAgent), + ) + return h, nil } From b81aecf26f877f52c83dc2cb92dc3bb6f3ba65b1 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Tue, 28 Jan 2020 17:02:31 +0530 Subject: [PATCH 06/32] finished introspection changes --- config/config.go | 9 ++------ p2p/host/basic/basic_host.go | 41 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/config/config.go b/config/config.go index 66e1d10cf9..b95403c014 100644 --- a/config/config.go +++ b/config/config.go @@ -15,7 +15,6 @@ import ( "github.com/libp2p/go-libp2p-core/pnet" "github.com/libp2p/go-libp2p-core/routing" - "github.com/libp2p/go-libp2p-introspection/introspection" bhost "github.com/libp2p/go-libp2p/p2p/host/basic" relay "github.com/libp2p/go-libp2p/p2p/host/relay" routed "github.com/libp2p/go-libp2p/p2p/host/routed" @@ -118,13 +117,9 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { return nil, err } - introspector := cfg.Introspector - if introspector == nil { - introspector = introspection.NewDefaultIntrospector() - } // TODO: Make the swarm implementation configurable. - swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter, introspector) + swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter, cfg.Introspector) if cfg.Filters != nil { swrm.Filters = cfg.Filters } @@ -135,7 +130,7 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { NATManager: cfg.NATManager, EnablePing: !cfg.DisablePing, UserAgent: cfg.UserAgent, - Introspector: introspector, + Introspector: cfg.Introspector, }) if err != nil { diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 39f3514c32..c69c479482 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -184,28 +184,28 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo h.pings = ping.NewPingService(h) } - if h.introspector == nil { - h.introspector = introspection.NewDefaultIntrospector() - } - net.SetConnHandler(h.newConnHandler) net.SetStreamHandler(h.newStreamHandler) - // TODO What is Version ? - // register runtime provider - if err := h.introspector.RegisterProviders(&introspect.ProvidersMap{Runtime: func() (*introspect.Runtime, error) { - return &introspect.Runtime{Implementation: "go-libp2p", - Platform: runtime2.GOOS, - PeerId: h.ID().Pretty(), - Version: "", - }, nil - }}); err != nil { - log.Errorf("failed to register a runtime provider, err=%s", err) - } - // TODO Resolve the discussion on address // start introspection server - introspectClose := introspection.StartServer("address", h.introspector) + var introspectCloseFnc func() error + if h.introspector != nil { + // TODO What is Version ? + // register runtime provider + if err := h.introspector.RegisterProviders(&introspect.ProvidersMap{Runtime: func() (*introspect.Runtime, error) { + return &introspect.Runtime{Implementation: "go-libp2p", + Platform: runtime2.GOOS, + PeerId: h.ID().Pretty(), + Version: "", + }, nil + }}); err != nil { + log.Errorf("failed to register a runtime provider, err=%s", err) + } + + // start server + introspectCloseFnc = introspection.StartServer(h.introspector) + } h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { if h.natmgr != nil { @@ -216,10 +216,11 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo } _ = h.emitters.evtLocalProtocolsUpdated.Close() - if err := introspectClose(); err != nil { - log.Errorf("error while shutting down introspection server, err=%s", err) + if h.introspector != nil { + if err := introspectCloseFnc(); err != nil { + log.Errorf("error while shutting down introspection server, err=%s", err) + } } - return h.Network().Close() }) From 691c34586b2477ccc628066f46a8f8798fb715c8 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 29 Jan 2020 21:46:19 +0530 Subject: [PATCH 07/32] end to end tests --- config/config.go | 1 - introspect_test.go | 190 +++++++++++++++++++++++++++++++++++ p2p/host/basic/basic_host.go | 1 - 3 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 introspect_test.go diff --git a/config/config.go b/config/config.go index b95403c014..4c476b0214 100644 --- a/config/config.go +++ b/config/config.go @@ -117,7 +117,6 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { return nil, err } - // TODO: Make the swarm implementation configurable. swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter, cfg.Introspector) if cfg.Filters != nil { diff --git a/introspect_test.go b/introspect_test.go new file mode 100644 index 0000000000..1cd83276be --- /dev/null +++ b/introspect_test.go @@ -0,0 +1,190 @@ +package libp2p + +import ( + "context" + "github.com/golang/protobuf/proto" + "github.com/gorilla/websocket" + "github.com/libp2p/go-libp2p-core/introspect" + "github.com/libp2p/go-libp2p-core/metrics" + "github.com/libp2p/go-libp2p-core/network" + "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p-introspection/introspection" + "github.com/stretchr/testify/require" + "net/url" + "runtime" + "sync" + "testing" + "time" +) + +func TestIntrospector(t *testing.T) { + msg1 := []byte("1") + msg2 := []byte("12") + msg3 := []byte("111") + msg4 := []byte("0000") + + iaddr := "0.0.0.0:9999" + ctx := context.Background() + + // create host 1 with introspector + h1, err := New(ctx, Introspector(introspection.NewDefaultIntrospector(iaddr)), BandwidthReporter(metrics.NewBandwidthCounter())) + require.NoError(t, err) + defer h1.Close() + + // create host 2 + h2, err := New(ctx) + defer h2.Close() + + // create host 3 + h3, err := New(ctx) + defer h3.Close() + + // host1 -> CONNECTS -> host2 + require.NoError(t, h1.Connect(ctx, peer.AddrInfo{h2.ID(), h2.Addrs()})) + + // host3 -> CONNECTS -> host1 + require.NoError(t, h3.Connect(ctx, peer.AddrInfo{h1.ID(), h1.Addrs()})) + + // host1 -> OPENS STREAM 1 -> host3, Writes a message & then reads the response + var wg sync.WaitGroup + p1 := protocol.ID("h1h3") + h3.SetStreamHandler(p1, func(s network.Stream) { + bz := make([]byte, len(msg1)) + _, err := s.Read(bz) + require.NoError(t, err) + _, err = s.Write(msg2) + require.NoError(t, err) + wg.Done() + }) + s1, err := h1.NewStream(ctx, h3.ID(), p1) + require.NoError(t, err) + wg.Add(1) + _, err = s1.Write(msg1) + require.NoError(t, err) + bz1 := make([]byte, len(msg2)) + wg.Wait() + _, err = s1.Read(bz1) + require.NoError(t, err) + + // host2 -> OPENS Stream 2 -> host1 , writes a message & reads the response + p2 := protocol.ID("h2h1") + h1.SetStreamHandler(p2, func(s network.Stream) { + bz := make([]byte, len(msg3)) + _, err := s.Read(bz) + require.NoError(t, err) + _, err = s.Write(msg4) + require.NoError(t, err) + wg.Done() + }) + + s2, err := h2.NewStream(ctx, h1.ID(), p2) + require.NoError(t, err) + wg.Add(1) + _, err = s2.Write(msg3) + require.NoError(t, err) + bz2 := make([]byte, len(msg4)) + wg.Wait() + _, err = s2.Read(bz2) + require.NoError(t, err) + + // call introspection server & fetch state + u := url.URL{Scheme: "ws", Host: iaddr, Path: "/introspect"} + + // wait till connection is established + i := 0 + var connection *websocket.Conn + for { + require.Less(t, i, 5, "failed to start server even after 5 attempts") + connection, _, err = websocket.DefaultDialer.Dial(u.String(), nil) + if err == nil { + break + } + i++ + time.Sleep(500 * time.Millisecond) + } + defer connection.Close() + + // fetch & unmarshal h1 state till ALL BANDWIDTH METERES kick in + var state *introspect.State + for { + require.NoError(t, connection.WriteMessage(websocket.TextMessage, []byte("trigger fetch"))) + // read snapshot + _, msg, err := connection.ReadMessage() + require.NoError(t, err) + require.NotEmpty(t, msg) + + state = &introspect.State{} + require.NoError(t, proto.Unmarshal(msg, state)) + if state.Traffic.TrafficOut.CumBytes != 0 && + state.Subsystems.Connections[0].Traffic.TrafficOut.CumBytes != 0 && state.Subsystems.Connections[1].Traffic.TrafficOut.CumBytes != 0 { + break + } + } + + // Assert State + + // Version + require.Equal(t, introspect.ProtoVersion, state.Version.Number) + + // Runtime + require.Equal(t, h1.ID().String(), state.Runtime.PeerId) + require.Equal(t, runtime.GOOS, state.Runtime.Platform) + require.Equal(t, "go-libp2p", state.Runtime.Implementation) + + // Overall Traffic + require.Greater(t, state.Traffic.TrafficIn.CumBytes, uint64(100)) + require.Greater(t, state.Traffic.TrafficOut.CumBytes, uint64(100)) + + // Connections + conns := state.Subsystems.Connections + peerIdToConns := make(map[string]*introspect.Connection) + for _, c := range conns { + peerIdToConns[c.PeerId] = c + } + require.Len(t, peerIdToConns, 2) + + pconn := make(map[string]network.Conn) + for _, c := range h1.Network().Conns() { + pconn[c.RemotePeer().String()] = c + } + require.Len(t, pconn, 2) + + // host1 -> host2 connection + h2Conn := peerIdToConns[h2.ID().String()] + require.NotEmpty(t, h2Conn.Id) + require.Equal(t, introspect.Status_ACTIVE, h2Conn.Status) + require.Equal(t, pconn[h2.ID().String()].LocalMultiaddr().String(), h2Conn.Endpoints.SrcMultiaddr) + require.Equal(t, pconn[h2.ID().String()].RemoteMultiaddr().String(), h2Conn.Endpoints.DstMultiaddr) + require.Equal(t, introspect.Role_INITIATOR, h2Conn.Role) + require.Equal(t, uint64(len(msg3)), h2Conn.Traffic.TrafficIn.CumBytes) + + // host3 -> host1 connection + h3Conn := peerIdToConns[h3.ID().String()] + require.NotEmpty(t, h3Conn.Id) + require.Equal(t, introspect.Status_ACTIVE, h3Conn.Status) + require.Equal(t, pconn[h3.ID().String()].LocalMultiaddr().String(), h3Conn.Endpoints.SrcMultiaddr) + require.Equal(t, pconn[h3.ID().String()].RemoteMultiaddr().String(), h3Conn.Endpoints.DstMultiaddr) + require.Equal(t, introspect.Role_RESPONDER, h3Conn.Role) + require.Equal(t, uint64(len(msg2)), h3Conn.Traffic.TrafficIn.CumBytes) + require.Equal(t, uint64(len(msg1)), h3Conn.Traffic.TrafficOut.CumBytes) + + // stream1 + require.Len(t, h3Conn.Streams.Streams, 1) + h3Stream := h3Conn.Streams.Streams[0] + require.NotEmpty(t, h3Stream.Id) + require.Equal(t, string(p1), h3Stream.Protocol) + require.Equal(t, introspect.Role_INITIATOR, h3Stream.Role) + require.Equal(t, introspect.Status_ACTIVE, h3Stream.Status) + require.True(t, len(msg1) == int(h3Stream.Traffic.TrafficOut.CumBytes)) + require.True(t, len(msg2) == int(h3Stream.Traffic.TrafficIn.CumBytes)) + + // stream 2 + require.Len(t, h2Conn.Streams.Streams, 1) + h1Stream := h2Conn.Streams.Streams[0] + require.NotEmpty(t, h1Stream.Id) + require.Equal(t, string(p2), h1Stream.Protocol) + require.Equal(t, introspect.Role_RESPONDER, h1Stream.Role) + require.Equal(t, introspect.Status_ACTIVE, h1Stream.Status) + require.True(t, len(msg3) == int(h1Stream.Traffic.TrafficIn.CumBytes)) +} diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index c69c479482..8b414b42a4 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -187,7 +187,6 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo net.SetConnHandler(h.newConnHandler) net.SetStreamHandler(h.newStreamHandler) - // start introspection server var introspectCloseFnc func() error if h.introspector != nil { From 570621a751a209c31b2a790b0c168ef92d441ebe Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 29 Jan 2020 21:53:36 +0530 Subject: [PATCH 08/32] fix fmt --- introspect_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/introspect_test.go b/introspect_test.go index 1cd83276be..8b61bcdec7 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -187,4 +187,4 @@ func TestIntrospector(t *testing.T) { require.Equal(t, introspect.Role_RESPONDER, h1Stream.Role) require.Equal(t, introspect.Status_ACTIVE, h1Stream.Status) require.True(t, len(msg3) == int(h1Stream.Traffic.TrafficIn.CumBytes)) -} +} \ No newline at end of file From 1f4ed273c796105a9c5a13217c92ee15d633f7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 10 Feb 2020 15:57:21 +0000 Subject: [PATCH 09/32] reformulate host options for introspection. --- config/config.go | 26 ++++- go.mod | 10 +- go.sum | 85 ++++----------- introspect_test.go | 203 +++++++++++++++++++---------------- options.go | 20 +++- p2p/host/basic/basic_host.go | 60 +++++++---- 6 files changed, 214 insertions(+), 190 deletions(-) diff --git a/config/config.go b/config/config.go index 4c476b0214..e9dd6057ae 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,7 @@ import ( "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/introspect" + "github.com/libp2p/go-libp2p-core/introspection" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" @@ -40,6 +40,10 @@ type NATManagerC func(network.Network) bhost.NATManager type RoutingC func(host.Host) (routing.PeerRouting, error) +// IntrospectionEndpointC is a type that represents an introspection.Endpoint +// constructor. +type IntrospectionEndpointC func(introspection.Introspector) (introspection.Endpoint, error) + // Config describes a set of settings for a libp2p node // // This is *not* a stable interface. Use the options defined in the root @@ -79,7 +83,8 @@ type Config struct { EnableAutoRelay bool StaticRelays []peer.AddrInfo - Introspector introspect.Introspector + Introspector introspection.Introspector + IntrospectionEndpoint IntrospectionEndpointC } // NewNode constructs a new libp2p Host from the Config. @@ -123,17 +128,28 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { swrm.Filters = cfg.Filters } - h, err := bhost.NewHost(ctx, swrm, &bhost.HostOpts{ + opts := &bhost.HostOpts{ ConnManager: cfg.ConnManager, AddrsFactory: cfg.AddrsFactory, NATManager: cfg.NATManager, EnablePing: !cfg.DisablePing, UserAgent: cfg.UserAgent, Introspector: cfg.Introspector, - }) + } + + if cfg.Introspector != nil && cfg.IntrospectionEndpoint != nil { + opts.IntrospectionEndpoint, err = cfg.IntrospectionEndpoint(cfg.Introspector) + if err != nil { + swrm.Close() + return nil, fmt.Errorf("failed while starting introspection endpoint: %w", err) + } + } + + h, err := bhost.NewHost(ctx, swrm, opts) if err != nil { - swrm.Close() + _ = swrm.Close() + _ = opts.IntrospectionEndpoint.Close() return nil, err } diff --git a/go.mod b/go.mod index 1c12af8207..4dfa0a7aa2 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,12 @@ module github.com/libp2p/go-libp2p require ( github.com/gogo/protobuf v1.3.1 + github.com/golang/protobuf v1.3.2 + github.com/gorilla/websocket v1.4.1 github.com/ipfs/go-cid v0.0.4 github.com/ipfs/go-detect-race v0.0.1 github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 + github.com/ipfs/go-log v1.0.1 github.com/jbenet/go-cienv v0.1.0 github.com/jbenet/goprocess v0.1.3 github.com/libp2p/go-conn-security-multistream v0.1.0 @@ -13,8 +15,9 @@ require ( github.com/libp2p/go-libp2p-autonat v0.1.1 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.4 - github.com/libp2p/go-libp2p-core v0.3.0 + github.com/libp2p/go-libp2p-core v0.3.1-0.20200207145311-a52ff097a8de github.com/libp2p/go-libp2p-discovery v0.2.0 + github.com/libp2p/go-libp2p-introspector v0.0.3 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.5 @@ -34,7 +37,10 @@ require ( github.com/multiformats/go-multiaddr-dns v0.2.0 github.com/multiformats/go-multiaddr-net v0.1.1 github.com/multiformats/go-multistream v0.1.0 + github.com/pkg/errors v0.9.1 // indirect + github.com/stretchr/testify v1.4.0 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect ) diff --git a/go.sum b/go.sum index 2e6e8bee0e..f1c6c487d1 100644 --- a/go.sum +++ b/go.sum @@ -5,15 +5,9 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 h1:A/EVblehb75cUgXA5njHPn0kLAsykn6mJGz7rnmW5W0= -github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= @@ -32,7 +26,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -42,8 +35,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -54,9 +45,9 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= @@ -65,7 +56,6 @@ github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvK github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -74,12 +64,11 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= +github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.3 h1:UIAh32wymBpStoe83YCzwVQQ5Oy/H0FdxvUS6DJDzms= -github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.4 h1:UlfXKrZx1DjZoBhQHmNHLC1fK1dUJDN20Y28A7s+gJ8= github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= @@ -88,7 +77,6 @@ github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRV github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8= @@ -97,6 +85,10 @@ github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= +github.com/ipfs/go-log v1.0.1 h1:5lIEEOQTk/vd1WuPFBRqz2mcp+5G1fMVcW+Ib/H5Hfo= +github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I= +github.com/ipfs/go-log/v2 v2.0.1 h1:mnR9XFltezAtO8A6tj5U7nKkRzhEQNEw/wT11U2HhPM= +github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= @@ -134,8 +126,6 @@ github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= github.com/libp2p/go-eventbus v0.1.0 h1:mlawomSAjjkk97QnYiEmHsLu7E136+2oCWSHRUvMfzQ= github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-libp2p-autonat v0.1.1 h1:WLBZcIRsjZlWdAZj9CiBSvU2wQXoUOiS1Zk1tM7DTJI= @@ -145,20 +135,9 @@ github.com/libp2p/go-libp2p-blankhost v0.1.4 h1:I96SWjR4rK9irDHcHq3XHN6hawCRTPUA github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= github.com/libp2p/go-libp2p-circuit v0.1.4 h1:Phzbmrg3BkVzbqd4ZZ149JxCuUWu2wZcXf/Kr6hZJj8= github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= -github.com/libp2p/go-libp2p-core v0.2.0 h1:ycFtuNwtZBAJSxzaHbyv6NjG3Yj5Nmra1csHaQ3zwaw= -github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= -github.com/libp2p/go-libp2p-core v0.2.2 h1:Sv1ggdoMx9c7v7FOFkR7agraHCnAgqYsXrU1ARSRUMs= -github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= -github.com/libp2p/go-libp2p-core v0.2.4 h1:Et6ykkTwI6PU44tr8qUF9k43vP0aduMNniShAbUJJw8= -github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= -github.com/libp2p/go-libp2p-core v0.3.0 h1:F7PqduvrztDtFsAa/bcheQ3azmNo+Nq7m8hQY5GiUW8= -github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= -github.com/libp2p/go-libp2p-introspection v0.0.0-20200123110920-ee44b5738886 h1:aCvSYZQ487Xt/ELd6QM4J/Qws5jGy0DmrHwJIUMGi40= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -170,19 +149,10 @@ github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLK github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-peerstore v0.1.3 h1:wMgajt1uM2tMiqf4M+4qWKVyyFc8SfA+84VV9glZq1M= -github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= github.com/libp2p/go-libp2p-peerstore v0.1.4 h1:d23fvq5oYMJ/lkkbO4oTwBp/JP+I/1m5gZJobNXCE/k= github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-secio v0.2.0 h1:ywzZBsWEEz2KNTn5RtzauEDq5RFEefPsttXYwAWqHng= -github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= github.com/libp2p/go-libp2p-secio v0.2.1 h1:eNWbJTdyPA7NxhP7J3c5lT97DC5d+u+IldkgCYFTPVA= github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-swarm v0.2.2 h1:T4hUpgEs2r371PweU3DuH7EOmBIdTBCwWs+FLcgx3bQ= -github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= @@ -193,7 +163,6 @@ github.com/libp2p/go-libp2p-testing v0.1.1 h1:U03z3HnGI7Ni8Xx6ONVZvUFOAzWYmolWf5 github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= github.com/libp2p/go-libp2p-yamux v0.2.1 h1:Q3XYNiKCC2vIxrvUJL+Jg1kiyeEaIDNKLjgEjo3VQdI= github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= @@ -202,16 +171,10 @@ github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDR github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.4 h1:agEFehY3zWJFUHK6SEMR7UYmk2z6kC3oeCM7ybLhguA= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-nat v0.0.4 h1:KbizNnq8YIf7+Hn7+VFL/xE0eDrkPru2zIO9NMwL8UQ= github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo= -github.com/libp2p/go-openssl v0.0.2 h1:9pP2d3Ubaxkv7ZisLjx9BFwgOGnQdQYnfcH29HNY3ls= -github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= -github.com/libp2p/go-openssl v0.0.3 h1:wjlG7HvQkt4Fq4cfH33Ivpwp0omaElYEi9z26qaIkIk= -github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-openssl v0.0.4 h1:d27YZvLoTyMhIN4njrkr8zMDOM4lfpHIp6A+TK9fovg= github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= @@ -221,13 +184,10 @@ github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA2 github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= github.com/libp2p/go-tcp-transport v0.1.1 h1:yGlqURmqgNA2fvzjSgZNlHcsd/IulAnKM8Ncu+vlqnw= github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= github.com/libp2p/go-ws-transport v0.2.0 h1:MJCw2OrPA9+76YNRvdo1wMnSOxb9Bivj6sVFY1Xrj6w= github.com/libp2p/go-ws-transport v0.2.0/go.mod h1:9BHJz/4Q5A9ludYWKoGCFC5gUElzlHoKzu0yY9p/klM= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -246,8 +206,6 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 h1:MHkK1uRtFbVqvAgvWxafZe54+5uBxLluGylDiKgdhwo= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= @@ -255,7 +213,6 @@ github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= @@ -272,12 +229,8 @@ github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU github.com/multiformats/go-multiaddr v0.2.0 h1:lR52sFwcTCuQb6bTfnXF6zA2XfyYvyd+5a9qECv/J90= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= @@ -308,17 +261,19 @@ github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smola/gocompat v0.2.0 h1:6b1oIMlUXIpz//VKEDzPVBK8KG7beVwmHIUEBIs/Pns= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -352,23 +307,22 @@ github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1: github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.1 h1:8dP3SGL7MPB94crU3bEPplMPe83FI4EouesJUeFHv50= -go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 h1:IcSOAf4PyMp3U3XbIEj1/xJ2BjNN2jWv7JoyOsMxXUU= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -422,7 +376,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/introspect_test.go b/introspect_test.go index 8b61bcdec7..f63f8559ed 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -2,34 +2,48 @@ package libp2p import ( "context" - "github.com/golang/protobuf/proto" - "github.com/gorilla/websocket" - "github.com/libp2p/go-libp2p-core/introspect" + "fmt" + "io" + "runtime" + "testing" + "time" + + "github.com/libp2p/go-libp2p-core/host" + "github.com/libp2p/go-libp2p-core/introspection" + introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/protocol" - "github.com/libp2p/go-libp2p-introspection/introspection" + introspector "github.com/libp2p/go-libp2p-introspector" + + "github.com/golang/protobuf/proto" + "github.com/gorilla/websocket" "github.com/stretchr/testify/require" - "net/url" - "runtime" - "sync" - "testing" - "time" ) func TestIntrospector(t *testing.T) { + require := require.New(t) + msg1 := []byte("1") msg2 := []byte("12") msg3 := []byte("111") msg4 := []byte("0000") - iaddr := "0.0.0.0:9999" + iaddr := "127.0.0.1:0" ctx := context.Background() // create host 1 with introspector - h1, err := New(ctx, Introspector(introspection.NewDefaultIntrospector(iaddr)), BandwidthReporter(metrics.NewBandwidthCounter())) - require.NoError(t, err) + h1, err := New(ctx, + Introspector( + introspector.NewDefaultIntrospector(), + introspector.WsServerWithConfig(&introspector.WsServerConfig{ + ListenAddrs: []string{iaddr}, + }), + ), + BandwidthReporter(metrics.NewBandwidthCounter()), + ) + require.NoError(err) defer h1.Close() // create host 2 @@ -41,81 +55,84 @@ func TestIntrospector(t *testing.T) { defer h3.Close() // host1 -> CONNECTS -> host2 - require.NoError(t, h1.Connect(ctx, peer.AddrInfo{h2.ID(), h2.Addrs()})) + require.NoError(h1.Connect(ctx, peer.AddrInfo{ID: h2.ID(), Addrs: h2.Addrs()})) // host3 -> CONNECTS -> host1 - require.NoError(t, h3.Connect(ctx, peer.AddrInfo{h1.ID(), h1.Addrs()})) + require.NoError(h3.Connect(ctx, peer.AddrInfo{ID: h1.ID(), Addrs: h1.Addrs()})) // host1 -> OPENS STREAM 1 -> host3, Writes a message & then reads the response - var wg sync.WaitGroup p1 := protocol.ID("h1h3") h3.SetStreamHandler(p1, func(s network.Stream) { - bz := make([]byte, len(msg1)) - _, err := s.Read(bz) - require.NoError(t, err) + buf := make([]byte, len(msg1)) + + _, err := io.ReadFull(s, buf) + require.NoError(err) + _, err = s.Write(msg2) - require.NoError(t, err) - wg.Done() + require.NoError(err) }) + s1, err := h1.NewStream(ctx, h3.ID(), p1) - require.NoError(t, err) - wg.Add(1) + require.NoError(err) + _, err = s1.Write(msg1) - require.NoError(t, err) - bz1 := make([]byte, len(msg2)) - wg.Wait() - _, err = s1.Read(bz1) - require.NoError(t, err) + require.NoError(err) + + buf := make([]byte, len(msg2)) + _, err = io.ReadFull(s1, buf) + require.NoError(err) // host2 -> OPENS Stream 2 -> host1 , writes a message & reads the response p2 := protocol.ID("h2h1") h1.SetStreamHandler(p2, func(s network.Stream) { - bz := make([]byte, len(msg3)) - _, err := s.Read(bz) - require.NoError(t, err) + buf := make([]byte, len(msg3)) + + _, err := io.ReadFull(s, buf) + require.NoError(err) + _, err = s.Write(msg4) - require.NoError(t, err) - wg.Done() + require.NoError(err) }) s2, err := h2.NewStream(ctx, h1.ID(), p2) - require.NoError(t, err) - wg.Add(1) + require.NoError(err) + _, err = s2.Write(msg3) - require.NoError(t, err) - bz2 := make([]byte, len(msg4)) - wg.Wait() - _, err = s2.Read(bz2) - require.NoError(t, err) + require.NoError(err) + + buf = make([]byte, len(msg4)) + _, err = io.ReadFull(s2, buf) + require.NoError(err) // call introspection server & fetch state - u := url.URL{Scheme: "ws", Host: iaddr, Path: "/introspect"} + addrs := h1.(host.IntrospectableHost).IntrospectionEndpoint().ListenAddrs() + url := fmt.Sprintf("ws://%s/introspect", addrs[0]) + + fmt.Println(addrs) // wait till connection is established - i := 0 var connection *websocket.Conn - for { - require.Less(t, i, 5, "failed to start server even after 5 attempts") - connection, _, err = websocket.DefaultDialer.Dial(u.String(), nil) - if err == nil { - break - } - i++ - time.Sleep(500 * time.Millisecond) - } + require.Eventually(func() bool { + connection, _, err = websocket.DefaultDialer.Dial(url, nil) + return err == nil + }, 5*time.Second, 500*time.Millisecond) + defer connection.Close() - // fetch & unmarshal h1 state till ALL BANDWIDTH METERES kick in - var state *introspect.State + // fetch & unmarshal h1 state until all bandwidth meters kick in. + var state *introspection_pb.State + + // TODO this loop can run forever for { - require.NoError(t, connection.WriteMessage(websocket.TextMessage, []byte("trigger fetch"))) + require.NoError(connection.WriteMessage(websocket.TextMessage, []byte("trigger fetch"))) + // read snapshot _, msg, err := connection.ReadMessage() - require.NoError(t, err) - require.NotEmpty(t, msg) + require.NoError(err) + require.NotEmpty(msg) - state = &introspect.State{} - require.NoError(t, proto.Unmarshal(msg, state)) + state = &introspection_pb.State{} + require.NoError(proto.Unmarshal(msg, state)) if state.Traffic.TrafficOut.CumBytes != 0 && state.Subsystems.Connections[0].Traffic.TrafficOut.CumBytes != 0 && state.Subsystems.Connections[1].Traffic.TrafficOut.CumBytes != 0 { break @@ -125,66 +142,66 @@ func TestIntrospector(t *testing.T) { // Assert State // Version - require.Equal(t, introspect.ProtoVersion, state.Version.Number) + require.Equal(introspection.ProtoVersion, state.Version.Number) // Runtime - require.Equal(t, h1.ID().String(), state.Runtime.PeerId) - require.Equal(t, runtime.GOOS, state.Runtime.Platform) - require.Equal(t, "go-libp2p", state.Runtime.Implementation) + require.Equal(h1.ID().String(), state.Runtime.PeerId) + require.Equal(runtime.GOOS, state.Runtime.Platform) + require.Equal("go-libp2p", state.Runtime.Implementation) // Overall Traffic - require.Greater(t, state.Traffic.TrafficIn.CumBytes, uint64(100)) - require.Greater(t, state.Traffic.TrafficOut.CumBytes, uint64(100)) + require.Greater(state.Traffic.TrafficIn.CumBytes, uint64(100)) + require.Greater(state.Traffic.TrafficOut.CumBytes, uint64(100)) // Connections conns := state.Subsystems.Connections - peerIdToConns := make(map[string]*introspect.Connection) + peerIdToConns := make(map[string]*introspection_pb.Connection) for _, c := range conns { peerIdToConns[c.PeerId] = c } - require.Len(t, peerIdToConns, 2) + require.Len(peerIdToConns, 2) pconn := make(map[string]network.Conn) for _, c := range h1.Network().Conns() { pconn[c.RemotePeer().String()] = c } - require.Len(t, pconn, 2) + require.Len(pconn, 2) // host1 -> host2 connection h2Conn := peerIdToConns[h2.ID().String()] - require.NotEmpty(t, h2Conn.Id) - require.Equal(t, introspect.Status_ACTIVE, h2Conn.Status) - require.Equal(t, pconn[h2.ID().String()].LocalMultiaddr().String(), h2Conn.Endpoints.SrcMultiaddr) - require.Equal(t, pconn[h2.ID().String()].RemoteMultiaddr().String(), h2Conn.Endpoints.DstMultiaddr) - require.Equal(t, introspect.Role_INITIATOR, h2Conn.Role) - require.Equal(t, uint64(len(msg3)), h2Conn.Traffic.TrafficIn.CumBytes) + require.NotEmpty(h2Conn.Id) + require.Equal(introspection_pb.Status_ACTIVE, h2Conn.Status) + require.Equal(pconn[h2.ID().String()].LocalMultiaddr().String(), h2Conn.Endpoints.SrcMultiaddr) + require.Equal(pconn[h2.ID().String()].RemoteMultiaddr().String(), h2Conn.Endpoints.DstMultiaddr) + require.Equal(introspection_pb.Role_INITIATOR, h2Conn.Role) + require.Greater(h2Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg3))) // host3 -> host1 connection h3Conn := peerIdToConns[h3.ID().String()] - require.NotEmpty(t, h3Conn.Id) - require.Equal(t, introspect.Status_ACTIVE, h3Conn.Status) - require.Equal(t, pconn[h3.ID().String()].LocalMultiaddr().String(), h3Conn.Endpoints.SrcMultiaddr) - require.Equal(t, pconn[h3.ID().String()].RemoteMultiaddr().String(), h3Conn.Endpoints.DstMultiaddr) - require.Equal(t, introspect.Role_RESPONDER, h3Conn.Role) - require.Equal(t, uint64(len(msg2)), h3Conn.Traffic.TrafficIn.CumBytes) - require.Equal(t, uint64(len(msg1)), h3Conn.Traffic.TrafficOut.CumBytes) + require.NotEmpty(h3Conn.Id) + require.Equal(introspection_pb.Status_ACTIVE, h3Conn.Status) + require.Equal(pconn[h3.ID().String()].LocalMultiaddr().String(), h3Conn.Endpoints.SrcMultiaddr) + require.Equal(pconn[h3.ID().String()].RemoteMultiaddr().String(), h3Conn.Endpoints.DstMultiaddr) + require.Equal(introspection_pb.Role_RESPONDER, h3Conn.Role) + require.Greater(h3Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg2))) + require.Greater(h3Conn.Traffic.TrafficOut.CumBytes, uint64(len(msg1))) // stream1 - require.Len(t, h3Conn.Streams.Streams, 1) + require.Len(h3Conn.Streams.Streams, 1) h3Stream := h3Conn.Streams.Streams[0] - require.NotEmpty(t, h3Stream.Id) - require.Equal(t, string(p1), h3Stream.Protocol) - require.Equal(t, introspect.Role_INITIATOR, h3Stream.Role) - require.Equal(t, introspect.Status_ACTIVE, h3Stream.Status) - require.True(t, len(msg1) == int(h3Stream.Traffic.TrafficOut.CumBytes)) - require.True(t, len(msg2) == int(h3Stream.Traffic.TrafficIn.CumBytes)) + require.NotEmpty(h3Stream.Id) + require.Equal(string(p1), h3Stream.Protocol) + require.Equal(introspection_pb.Role_INITIATOR, h3Stream.Role) + require.Equal(introspection_pb.Status_ACTIVE, h3Stream.Status) + // require.True(len(msg1) == int(h3Stream.Traffic.TrafficOut.CumBytes)) + // require.True(len(msg2) == int(h3Stream.Traffic.TrafficIn.CumBytes)) // stream 2 - require.Len(t, h2Conn.Streams.Streams, 1) + require.Len(h2Conn.Streams.Streams, 1) h1Stream := h2Conn.Streams.Streams[0] - require.NotEmpty(t, h1Stream.Id) - require.Equal(t, string(p2), h1Stream.Protocol) - require.Equal(t, introspect.Role_RESPONDER, h1Stream.Role) - require.Equal(t, introspect.Status_ACTIVE, h1Stream.Status) - require.True(t, len(msg3) == int(h1Stream.Traffic.TrafficIn.CumBytes)) -} \ No newline at end of file + require.NotEmpty(h1Stream.Id) + require.Equal(string(p2), h1Stream.Protocol) + require.Equal(introspection_pb.Role_RESPONDER, h1Stream.Role) + require.Equal(introspection_pb.Status_ACTIVE, h1Stream.Status) + // require.True(len(msg3) == int(h1Stream.Traffic.TrafficIn.CumBytes)) +} diff --git a/options.go b/options.go index 52b5f79059..3b4a021e23 100644 --- a/options.go +++ b/options.go @@ -9,7 +9,7 @@ import ( "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/introspect" + "github.com/libp2p/go-libp2p-core/introspection" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" @@ -194,13 +194,27 @@ func ConnectionManager(connman connmgr.ConnManager) Option { } } -// Introspector configures the host to use the given introspector -func Introspector(i introspect.Introspector) Option { +// Introspector configures the host to use the given introspector, and the +// supplied endpoint constructor. +// +// Example: +// +// import "github.com/libp2p/go-libp2p-introspector" +// +// host, err := libp2p.New( +// libp2p.Introspector( +// introspector.NewDefaultIntrospector(), +// introspector.WsEndpointWithConfig(&introspector.WsEndpointConfig{}), +// ), +// ) +// +func Introspector(i introspection.Introspector, endpointCtor config.IntrospectionEndpointC) Option { return func(cfg *Config) error { if cfg.Introspector != nil { return fmt.Errorf("cannot specify multiple introspectors") } cfg.Introspector = i + cfg.IntrospectionEndpoint = endpointCtor return nil } } diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 8b414b42a4..8f32b44732 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -2,20 +2,21 @@ package basichost import ( "context" + "fmt" "io" "net" - runtime2 "runtime" + "runtime" "sync" "time" - "github.com/libp2p/go-libp2p-introspection/introspection" "github.com/libp2p/go-libp2p/p2p/protocol/identify" "github.com/libp2p/go-libp2p/p2p/protocol/ping" "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/event" "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/introspect" + "github.com/libp2p/go-libp2p-core/introspection" + introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" @@ -95,7 +96,8 @@ type BasicHost struct { evtLocalProtocolsUpdated event.Emitter } - introspector introspect.Introspector + introspector introspection.Introspector + introspectionEndpoint introspection.Endpoint } var _ host.Host = (*BasicHost)(nil) @@ -132,8 +134,13 @@ type HostOpts struct { // UserAgent sets the user-agent for the host. Defaults to ClientVersion. UserAgent string - // Introspector is used by host subsystems to register themselves as metrics providers & fetch the current state. - Introspector introspect.Introspector + // Introspector is used by host subsystems to register themselves as metrics + // providers and fetch the current state. + Introspector introspection.Introspector + + // IntrospectionEndpoint is the introspection endpoint through which + // introspection data is served to clients. + IntrospectionEndpoint introspection.Endpoint } // NewHost constructs a new *BasicHost and activates it by attaching its stream and connection handlers to the given inet.Network. @@ -188,22 +195,28 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo net.SetStreamHandler(h.newStreamHandler) // start introspection server - var introspectCloseFnc func() error + h.introspectionEndpoint = opts.IntrospectionEndpoint if h.introspector != nil { - // TODO What is Version ? - // register runtime provider - if err := h.introspector.RegisterProviders(&introspect.ProvidersMap{Runtime: func() (*introspect.Runtime, error) { - return &introspect.Runtime{Implementation: "go-libp2p", - Platform: runtime2.GOOS, - PeerId: h.ID().Pretty(), - Version: "", + runtimeDataProvider := func() (*introspection_pb.Runtime, error) { + return &introspection_pb.Runtime{ + Implementation: "go-libp2p", + Platform: runtime.GOOS, + PeerId: h.ID().Pretty(), + Version: "", }, nil - }}); err != nil { + } + + // register runtime provider + provs := &introspection.DataProviders{Runtime: runtimeDataProvider} + if err := h.introspector.RegisterDataProviders(provs); err != nil { log.Errorf("failed to register a runtime provider, err=%s", err) } + } - // start server - introspectCloseFnc = introspection.StartServer(h.introspector) + if h.introspectionEndpoint != nil { + if err := h.introspectionEndpoint.Start(); err != nil { + return nil, fmt.Errorf("failed to start introspection endpoint: %w", err) + } } h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { @@ -215,11 +228,12 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo } _ = h.emitters.evtLocalProtocolsUpdated.Close() - if h.introspector != nil { - if err := introspectCloseFnc(); err != nil { - log.Errorf("error while shutting down introspection server, err=%s", err) + if h.introspectionEndpoint != nil { + if err := h.introspectionEndpoint.Close(); err != nil { + log.Errorf("failed while shutting down introspection endpoint; err: %s", err) } } + return h.Network().Close() }) @@ -233,10 +247,14 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo return h, nil } -func (h *BasicHost) Introspector() introspect.Introspector { +func (h *BasicHost) Introspector() introspection.Introspector { return h.introspector } +func (h *BasicHost) IntrospectionEndpoint() introspection.Endpoint { + return h.introspectionEndpoint +} + // New constructs and sets up a new *BasicHost with given Network and options. // The following options can be passed: // * NATPortMap From ff247cd154d7bc842b033dc824bc83522b6bae3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 10 Feb 2020 17:14:21 +0000 Subject: [PATCH 10/32] update go.mod (go-libp2p-{introspector,swarm,core}). --- go.mod | 9 +++---- go.sum | 83 ++++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 56 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 4dfa0a7aa2..a65707cd0f 100644 --- a/go.mod +++ b/go.mod @@ -15,16 +15,16 @@ require ( github.com/libp2p/go-libp2p-autonat v0.1.1 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.4 - github.com/libp2p/go-libp2p-core v0.3.1-0.20200207145311-a52ff097a8de + github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841 github.com/libp2p/go-libp2p-discovery v0.2.0 - github.com/libp2p/go-libp2p-introspector v0.0.3 + github.com/libp2p/go-libp2p-introspector v0.0.4 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.5 github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.1.4 github.com/libp2p/go-libp2p-secio v0.2.1 - github.com/libp2p/go-libp2p-swarm v0.2.2 + github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 github.com/libp2p/go-libp2p-yamux v0.2.1 @@ -35,12 +35,11 @@ require ( github.com/miekg/dns v1.1.12 // indirect github.com/multiformats/go-multiaddr v0.2.0 github.com/multiformats/go-multiaddr-dns v0.2.0 - github.com/multiformats/go-multiaddr-net v0.1.1 + github.com/multiformats/go-multiaddr-net v0.1.2 github.com/multiformats/go-multistream v0.1.0 github.com/pkg/errors v0.9.1 // indirect github.com/stretchr/testify v1.4.0 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 - golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect ) diff --git a/go.sum b/go.sum index f1c6c487d1..8a56225fbb 100644 --- a/go.sum +++ b/go.sum @@ -5,9 +5,13 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= +github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= @@ -26,6 +30,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= +github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -33,8 +38,8 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -43,11 +48,11 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= @@ -56,6 +61,7 @@ github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvK github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -67,8 +73,9 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.4 h1:UlfXKrZx1DjZoBhQHmNHLC1fK1dUJDN20Y28A7s+gJ8= github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= @@ -77,13 +84,13 @@ github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRV github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= +github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.1 h1:5lIEEOQTk/vd1WuPFBRqz2mcp+5G1fMVcW+Ib/H5Hfo= github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I= @@ -126,6 +133,7 @@ github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= github.com/libp2p/go-eventbus v0.1.0 h1:mlawomSAjjkk97QnYiEmHsLu7E136+2oCWSHRUvMfzQ= github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= +github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-libp2p-autonat v0.1.1 h1:WLBZcIRsjZlWdAZj9CiBSvU2wQXoUOiS1Zk1tM7DTJI= @@ -135,9 +143,19 @@ github.com/libp2p/go-libp2p-blankhost v0.1.4 h1:I96SWjR4rK9irDHcHq3XHN6hawCRTPUA github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= github.com/libp2p/go-libp2p-circuit v0.1.4 h1:Phzbmrg3BkVzbqd4ZZ149JxCuUWu2wZcXf/Kr6hZJj8= github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= +github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= +github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= +github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= +github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= +github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= +github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= +github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841 h1:NtLkfbsEXfR1mKM901b34Pw4VpEKQmCrtV7oQE6rIPQ= +github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= +github.com/libp2p/go-libp2p-introspector v0.0.4 h1:eA5JtLI8FwFUzDRC8waCeNzDZYDbMHyvMrBcHDikXvY= +github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+DcpBPgxmlHkQqHLz/zO7g+w= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -149,20 +167,26 @@ github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLK github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= +github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= github.com/libp2p/go-libp2p-peerstore v0.1.4 h1:d23fvq5oYMJ/lkkbO4oTwBp/JP+I/1m5gZJobNXCE/k= github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs= +github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= +github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= github.com/libp2p/go-libp2p-secio v0.2.1 h1:eNWbJTdyPA7NxhP7J3c5lT97DC5d+u+IldkgCYFTPVA= github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= +github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= +github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b h1:X8IJgQOPLQtBv/QpTLNIY9sR5Io0JPbJdyTxhlsiZd8= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b/go.mod h1:E4pVqEHsZsiEBuLviZcr417ED0VoSVraFhLPSPsMvGQ= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.1.0 h1:WaFRj/t3HdMZGNZqnU2pS7pDRBmMeoDx7/HDNpeyT9U= github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-testing v0.1.1 h1:U03z3HnGI7Ni8Xx6ONVZvUFOAzWYmolWf5W5jAOPNmU= github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= +github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= github.com/libp2p/go-libp2p-yamux v0.2.1 h1:Q3XYNiKCC2vIxrvUJL+Jg1kiyeEaIDNKLjgEjo3VQdI= github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= @@ -171,10 +195,13 @@ github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDR github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= +github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.4 h1:agEFehY3zWJFUHK6SEMR7UYmk2z6kC3oeCM7ybLhguA= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-nat v0.0.4 h1:KbizNnq8YIf7+Hn7+VFL/xE0eDrkPru2zIO9NMwL8UQ= github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo= +github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= +github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-openssl v0.0.4 h1:d27YZvLoTyMhIN4njrkr8zMDOM4lfpHIp6A+TK9fovg= github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= @@ -184,20 +211,19 @@ github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA2 github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= +github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= github.com/libp2p/go-tcp-transport v0.1.1 h1:yGlqURmqgNA2fvzjSgZNlHcsd/IulAnKM8Ncu+vlqnw= github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= github.com/libp2p/go-ws-transport v0.2.0 h1:MJCw2OrPA9+76YNRvdo1wMnSOxb9Bivj6sVFY1Xrj6w= github.com/libp2p/go-ws-transport v0.2.0/go.mod h1:9BHJz/4Q5A9ludYWKoGCFC5gUElzlHoKzu0yY9p/klM= +github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.1.12 h1:WMhc1ik4LNkTg8U9l3hI1LvxKmIL+f1+WV/SZtCbDDA= @@ -206,14 +232,14 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 h1:MHkK1uRtFbVqvAgvWxafZe54+5uBxLluGylDiKgdhwo= +github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= +github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -221,37 +247,36 @@ github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.1 h1:rVAztJYMhCQ7vEFr8FvxW3mS+HF2eY/oPbOMeS0ZDnE= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0 h1:lR52sFwcTCuQb6bTfnXF6zA2XfyYvyd+5a9qECv/J90= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= +github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= +github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multiaddr-net v0.1.0 h1:ZepO8Ezwovd+7b5XPPDhQhayk1yt0AJpzQBpq9fejx4= github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= -github.com/multiformats/go-multiaddr-net v0.1.1 h1:jFFKUuXTXv+3ARyHZi3XUqQO+YWMKgBdhEvuGRfnL6s= github.com/multiformats/go-multiaddr-net v0.1.1/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= +github.com/multiformats/go-multiaddr-net v0.1.2 h1:P7zcBH9FRETdPkDrylcXVjQLQ2t1JQtNItZULWNWgeg= +github.com/multiformats/go-multiaddr-net v0.1.2/go.mod h1:QsWt3XK/3hwvNxZJp92iMQKME1qHfpYmyIjFVsSOY6Y= github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multihash v0.0.8 h1:wrYcW5yxSi3dU07n5jnuS5PrNwyHy0zRHGVoUugWvXg= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.10 h1:lMoNbh2Ssd9PUF74Nz008KGzGPlfeV6wH3rit5IIGCM= github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= +github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-varint v0.0.1 h1:TR/0rdQtnNxuN2IhiB639xC3tWM4IUi7DkTBVTdGW/M= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg= +github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= @@ -259,12 +284,10 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -272,8 +295,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smola/gocompat v0.2.0 h1:6b1oIMlUXIpz//VKEDzPVBK8KG7beVwmHIUEBIs/Pns= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -288,16 +311,13 @@ github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-logging v0.0.1 h1:fwpzlmT0kRC/Fmd0MdmGgJG/CXIZ6gFq46FQZjprUcc= github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE= github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= @@ -307,6 +327,8 @@ github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1: github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= @@ -319,10 +341,12 @@ golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= +golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -354,11 +378,9 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 h1:rOhMmluY6kLMhdnrivzec6lLgaVbMHMn2ISQXJeJ5EM= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -367,15 +389,14 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c h1:vamGzbGri8IKo20MQncCuljcQ5uAO6kaCeawQPVblAI= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= From 866ac1d56a916ab26d186c9df3811f990e1d75c3 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 12 Feb 2020 11:02:21 +0530 Subject: [PATCH 11/32] making routing host introspectable --- p2p/host/routed/routed.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/p2p/host/routed/routed.go b/p2p/host/routed/routed.go index aecab09568..dc2c0fd5b9 100644 --- a/p2p/host/routed/routed.go +++ b/p2p/host/routed/routed.go @@ -8,6 +8,7 @@ import ( "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/event" "github.com/libp2p/go-libp2p-core/host" + "github.com/libp2p/go-libp2p-core/introspection" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" @@ -22,6 +23,8 @@ import ( var log = logging.Logger("routedhost") +var _ host.IntrospectableHost = (*RoutedHost)(nil) + // AddressTTL is the expiry time for our addresses. // We expire them quickly. const AddressTTL = time.Second * 10 @@ -134,6 +137,22 @@ func logRoutingErrDifferentPeers(ctx context.Context, wanted, got peer.ID, err e log.Event(ctx, "routingError", lm) } +func (h *RoutedHost) Introspector() introspection.Introspector { + i, ok := h.host.(host.IntrospectableHost) + if !ok { + return nil + } + return i.Introspector() +} + +func (h *RoutedHost) IntrospectionEndpoint() introspection.Endpoint { + i, ok := h.host.(host.IntrospectableHost) + if !ok { + return nil + } + return i.IntrospectionEndpoint() +} + func (rh *RoutedHost) ID() peer.ID { return rh.host.ID() } From d7f277a210a936e4744ea7c7d4da6ef44b1021e5 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Tue, 14 Apr 2020 17:19:08 +0530 Subject: [PATCH 12/32] first draft --- go.mod | 7 +- go.sum | 2 + introspect_test.go | 127 ++++++++++++++++++++++++----------- p2p/host/basic/basic_host.go | 1 + 4 files changed, 95 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index a6e706c7a4..b7e615f350 100644 --- a/go.mod +++ b/go.mod @@ -43,4 +43,9 @@ require ( golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect ) -go 1.12 +replace github.com/libp2p/go-libp2p-core => /Users/aarshshah/go/src/github.com/libp2p/go-libp2p-core +replace github.com/libp2p/go-libp2p-introspector => /Users/aarshshah/go/src/github.com/libp2p/go-libp2p-introspector +replace github.com/libp2p/go-libp2p-swarm => /Users/aarshshah/go/src/github.com/libp2p/go-libp2p-swarm + + +go 1.12 \ No newline at end of file diff --git a/go.sum b/go.sum index 00b6a97b4c..e05f6f689f 100644 --- a/go.sum +++ b/go.sum @@ -289,6 +289,7 @@ github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -347,6 +348,7 @@ golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= diff --git a/introspect_test.go b/introspect_test.go index f63f8559ed..d6966d39c6 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -9,7 +9,7 @@ import ( "time" "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/introspection" + introspection "github.com/libp2p/go-libp2p-core/introspection" introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" @@ -17,19 +17,25 @@ import ( "github.com/libp2p/go-libp2p-core/protocol" introspector "github.com/libp2p/go-libp2p-introspector" - "github.com/golang/protobuf/proto" + "github.com/gogo/protobuf/proto" "github.com/gorilla/websocket" "github.com/stretchr/testify/require" ) +var ( + msg1 = []byte("1") + msg2 = []byte("12") + msg3 = []byte("111") + msg4 = []byte("0000") + + p1 = protocol.ID("h1h3") + p2 = protocol.ID("h2h1") +) + +// TODO Send Pause & Send Data func TestIntrospector(t *testing.T) { require := require.New(t) - msg1 := []byte("1") - msg2 := []byte("12") - msg3 := []byte("111") - msg4 := []byte("0000") - iaddr := "127.0.0.1:0" ctx := context.Background() @@ -61,7 +67,6 @@ func TestIntrospector(t *testing.T) { require.NoError(h3.Connect(ctx, peer.AddrInfo{ID: h1.ID(), Addrs: h1.Addrs()})) // host1 -> OPENS STREAM 1 -> host3, Writes a message & then reads the response - p1 := protocol.ID("h1h3") h3.SetStreamHandler(p1, func(s network.Stream) { buf := make([]byte, len(msg1)) @@ -83,7 +88,6 @@ func TestIntrospector(t *testing.T) { require.NoError(err) // host2 -> OPENS Stream 2 -> host1 , writes a message & reads the response - p2 := protocol.ID("h2h1") h1.SetStreamHandler(p2, func(s network.Stream) { buf := make([]byte, len(msg3)) @@ -104,7 +108,7 @@ func TestIntrospector(t *testing.T) { _, err = io.ReadFull(s2, buf) require.NoError(err) - // call introspection server & fetch state + // create a connection with the introspection server addrs := h1.(host.IntrospectableHost).IntrospectionEndpoint().ListenAddrs() url := fmt.Sprintf("ws://%s/introspect", addrs[0]) @@ -116,42 +120,67 @@ func TestIntrospector(t *testing.T) { connection, _, err = websocket.DefaultDialer.Dial(url, nil) return err == nil }, 5*time.Second, 500*time.Millisecond) - defer connection.Close() - // fetch & unmarshal h1 state until all bandwidth meters kick in. - var state *introspection_pb.State - - // TODO this loop can run forever - for { - require.NoError(connection.WriteMessage(websocket.TextMessage, []byte("trigger fetch"))) - - // read snapshot - _, msg, err := connection.ReadMessage() - require.NoError(err) - require.NotEmpty(msg) + // first, we get the runtime and assert it + pd := fetchProtocolWrapper(require, connection) + rt := pd.GetRuntime() + require.NotNil(t, rt) + require.Equal(h1.ID().String(), rt.PeerId) + require.Equal(runtime.GOOS, rt.Platform) + require.Equal("go-libp2p", rt.Implementation) + + // followed by the state message + pd = fetchProtocolWrapper(require, connection) + st := pd.GetState() + require.NotNil(t, st) + assertState(require, st, h1, h2, h3, false) + + // we should then periodically get a state message..lets; wait for one with traffic + var st2 *introspection_pb.State + require.Eventually(func() bool { + pd = fetchProtocolWrapper(require, connection) + st2 = pd.GetState() + require.NotNil(t, st2) - state = &introspection_pb.State{} - require.NoError(proto.Unmarshal(msg, state)) - if state.Traffic.TrafficOut.CumBytes != 0 && - state.Subsystems.Connections[0].Traffic.TrafficOut.CumBytes != 0 && state.Subsystems.Connections[1].Traffic.TrafficOut.CumBytes != 0 { - break + if st2.Traffic.TrafficOut.CumBytes != 0 && + st2.Subsystems.Connections[0].Traffic.TrafficOut.CumBytes != 0 && st2.Subsystems.Connections[1].Traffic.TrafficOut.CumBytes != 0 { + return true } - } - // Assert State + return false + }, 10*time.Second, 1500*time.Millisecond) + assertState(require, st2, h1, h2, h3, true) - // Version - require.Equal(introspection.ProtoVersion, state.Version.Number) + // Pause + cl := &introspection_pb.ClientSignal{Signal: introspection_pb.ClientSignal_PAUSE_PUSH_EMITTER} + bz, err := proto.Marshal(cl) + require.NoError(err) + require.NotEmpty(bz) + require.NoError(connection.WriteMessage(websocket.BinaryMessage, bz)) + time.Sleep(1 * time.Second) - // Runtime - require.Equal(h1.ID().String(), state.Runtime.PeerId) - require.Equal(runtime.GOOS, state.Runtime.Platform) - require.Equal("go-libp2p", state.Runtime.Implementation) + // We get a state message when we unpause + cl = &introspection_pb.ClientSignal{Signal: introspection_pb.ClientSignal_UNPAUSE_PUSH_EMITTER} + bz, err = proto.Marshal(cl) + require.NoError(err) + require.NotEmpty(bz) + require.NoError(connection.WriteMessage(websocket.BinaryMessage, bz)) + time.Sleep(1 * time.Second) + + pd = fetchProtocolWrapper(require, connection) + st = pd.GetState() + require.NotNil(t, st) + assertState(require, st, h1, h2, h3, true) +} - // Overall Traffic - require.Greater(state.Traffic.TrafficIn.CumBytes, uint64(100)) - require.Greater(state.Traffic.TrafficOut.CumBytes, uint64(100)) +func assertState(require *require.Assertions, state *introspection_pb.State, h1, h2, h3 host.Host, + assertTraffic bool) { + + if assertTraffic { + require.Greater(state.Traffic.TrafficIn.CumBytes, uint64(100)) + require.Greater(state.Traffic.TrafficOut.CumBytes, uint64(100)) + } // Connections conns := state.Subsystems.Connections @@ -174,7 +203,10 @@ func TestIntrospector(t *testing.T) { require.Equal(pconn[h2.ID().String()].LocalMultiaddr().String(), h2Conn.Endpoints.SrcMultiaddr) require.Equal(pconn[h2.ID().String()].RemoteMultiaddr().String(), h2Conn.Endpoints.DstMultiaddr) require.Equal(introspection_pb.Role_INITIATOR, h2Conn.Role) - require.Greater(h2Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg3))) + + if assertTraffic { + require.Greater(h2Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg3))) + } // host3 -> host1 connection h3Conn := peerIdToConns[h3.ID().String()] @@ -183,9 +215,11 @@ func TestIntrospector(t *testing.T) { require.Equal(pconn[h3.ID().String()].LocalMultiaddr().String(), h3Conn.Endpoints.SrcMultiaddr) require.Equal(pconn[h3.ID().String()].RemoteMultiaddr().String(), h3Conn.Endpoints.DstMultiaddr) require.Equal(introspection_pb.Role_RESPONDER, h3Conn.Role) - require.Greater(h3Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg2))) - require.Greater(h3Conn.Traffic.TrafficOut.CumBytes, uint64(len(msg1))) + if assertTraffic { + require.Greater(h3Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg2))) + require.Greater(h3Conn.Traffic.TrafficOut.CumBytes, uint64(len(msg1))) + } // stream1 require.Len(h3Conn.Streams.Streams, 1) h3Stream := h3Conn.Streams.Streams[0] @@ -205,3 +239,14 @@ func TestIntrospector(t *testing.T) { require.Equal(introspection_pb.Status_ACTIVE, h1Stream.Status) // require.True(len(msg3) == int(h1Stream.Traffic.TrafficIn.CumBytes)) } + +func fetchProtocolWrapper(require *require.Assertions, conn *websocket.Conn) *introspection_pb.ProtocolDataPacket { + _, msg, err := conn.ReadMessage() + require.NoError(err) + require.NotEmpty(msg) + pd := &introspection_pb.ProtocolDataPacket{} + require.NoError(proto.Unmarshal(msg, pd)) + require.NotNil(pd.Message) + require.Equal(introspection.ProtoVersion, pd.Version.Version) + return pd +} diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 8f32b44732..58b1e9de8f 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -197,6 +197,7 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo // start introspection server h.introspectionEndpoint = opts.IntrospectionEndpoint if h.introspector != nil { + // event types will be added to the runtime by the introspector runtimeDataProvider := func() (*introspection_pb.Runtime, error) { return &introspection_pb.Runtime{ Implementation: "go-libp2p", From 56f8ce3d25ef5688b83fd791587668468afb3b7b Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Tue, 14 Apr 2020 17:51:22 +0530 Subject: [PATCH 13/32] introspection 2.0 --- go.mod | 13 ++++--------- go.sum | 8 ++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index b7e615f350..6482f912f2 100644 --- a/go.mod +++ b/go.mod @@ -15,16 +15,16 @@ require ( github.com/libp2p/go-libp2p-autonat v0.1.1 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.4 - github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841 + github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b github.com/libp2p/go-libp2p-discovery v0.2.0 - github.com/libp2p/go-libp2p-introspector v0.0.4 + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200414121801-eb149715a3a3 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.5 github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.1.4 github.com/libp2p/go-libp2p-secio v0.2.1 - github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b + github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 github.com/libp2p/go-libp2p-yamux v0.2.1 @@ -43,9 +43,4 @@ require ( golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect ) -replace github.com/libp2p/go-libp2p-core => /Users/aarshshah/go/src/github.com/libp2p/go-libp2p-core -replace github.com/libp2p/go-libp2p-introspector => /Users/aarshshah/go/src/github.com/libp2p/go-libp2p-introspector -replace github.com/libp2p/go-libp2p-swarm => /Users/aarshshah/go/src/github.com/libp2p/go-libp2p-swarm - - -go 1.12 \ No newline at end of file +go 1.12 diff --git a/go.sum b/go.sum index e05f6f689f..92cc316910 100644 --- a/go.sum +++ b/go.sum @@ -152,11 +152,14 @@ github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841 h1:NtLkfbsEXfR1mKM901b34Pw4VpEKQmCrtV7oQE6rIPQ= github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b h1:/q9bdQKGXGhjQolx/d3N0mlU4m47W7fyo7Vsc9qwbyU= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= github.com/libp2p/go-libp2p-introspector v0.0.4 h1:eA5JtLI8FwFUzDRC8waCeNzDZYDbMHyvMrBcHDikXvY= github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+DcpBPgxmlHkQqHLz/zO7g+w= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200414121801-eb149715a3a3/go.mod h1:cAYGOcvtQ8dDwWh7JNw/aIL4blT/T6k75VJuf/oGFQk= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -179,6 +182,8 @@ github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evl github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b h1:X8IJgQOPLQtBv/QpTLNIY9sR5Io0JPbJdyTxhlsiZd8= github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b/go.mod h1:E4pVqEHsZsiEBuLviZcr417ED0VoSVraFhLPSPsMvGQ= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc h1:W7k2JllS7w4H2trNbmDFAfrKlclbZ5dV3V7abJZ7fz0= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc/go.mod h1:+Ls63IIPcQ0EC0rIwQewMaRvY/uDpR0XluNj8jRTHWA= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= @@ -221,6 +226,7 @@ github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZ github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -298,6 +304,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smola/gocompat v0.2.0 h1:6b1oIMlUXIpz//VKEDzPVBK8KG7beVwmHIUEBIs/Pns= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= @@ -394,6 +401,7 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= From f8e1fe90f36606afd02535b267e3b62f4e1754dc Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 15 Apr 2020 11:13:49 +0530 Subject: [PATCH 14/32] updated introspector deps --- go.mod | 2 +- go.sum | 2 ++ introspect_test.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 6482f912f2..8eb21831de 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/libp2p/go-libp2p-circuit v0.1.4 github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b github.com/libp2p/go-libp2p-discovery v0.2.0 - github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200414121801-eb149715a3a3 + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.5 diff --git a/go.sum b/go.sum index 92cc316910..c7b26536f8 100644 --- a/go.sum +++ b/go.sum @@ -160,6 +160,8 @@ github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfx github.com/libp2p/go-libp2p-introspector v0.0.4 h1:eA5JtLI8FwFUzDRC8waCeNzDZYDbMHyvMrBcHDikXvY= github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+DcpBPgxmlHkQqHLz/zO7g+w= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200414121801-eb149715a3a3/go.mod h1:cAYGOcvtQ8dDwWh7JNw/aIL4blT/T6k75VJuf/oGFQk= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98 h1:i81pfVEIkl0zoCA0snPfvW9AvmNryP44i2V7i+FX0Qw= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98/go.mod h1:Rj+ITkyYPNy/Da6qeFsbihCZvo7edX6NVIGMYbE/GB8= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= diff --git a/introspect_test.go b/introspect_test.go index d6966d39c6..b8d8d3df99 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -136,7 +136,7 @@ func TestIntrospector(t *testing.T) { require.NotNil(t, st) assertState(require, st, h1, h2, h3, false) - // we should then periodically get a state message..lets; wait for one with traffic + // we should then periodically get a state message..lets wait for one with traffic var st2 *introspection_pb.State require.Eventually(func() bool { pd = fetchProtocolWrapper(require, connection) From e3aa900c1507bb8c60c3eb60fbef9e294dfaee0d Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 15 Apr 2020 12:00:54 +0530 Subject: [PATCH 15/32] upgraded versions --- go.mod | 6 +++--- go.sum | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8eb21831de..aa1df65b41 100644 --- a/go.mod +++ b/go.mod @@ -15,16 +15,16 @@ require ( github.com/libp2p/go-libp2p-autonat v0.1.1 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.4 - github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b + github.com/libp2p/go-libp2p-core v0.3.2-0.20200415062127-fcc117eae71a github.com/libp2p/go-libp2p-discovery v0.2.0 - github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98 + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415062639-0a20c33da5ed github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.5 github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.1.4 github.com/libp2p/go-libp2p-secio v0.2.1 - github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc + github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200415062547-f2b463a0f478 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 github.com/libp2p/go-libp2p-yamux v0.2.1 diff --git a/go.sum b/go.sum index c7b26536f8..47cca384c2 100644 --- a/go.sum +++ b/go.sum @@ -154,6 +154,8 @@ github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841 h1:NtLkfbs github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b h1:/q9bdQKGXGhjQolx/d3N0mlU4m47W7fyo7Vsc9qwbyU= github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200415062127-fcc117eae71a h1:ijScFHS86L0LYjaagrxxinbsd1HIniHSKB2vFobmJ5s= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200415062127-fcc117eae71a/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= @@ -162,6 +164,8 @@ github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+Dc github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200414121801-eb149715a3a3/go.mod h1:cAYGOcvtQ8dDwWh7JNw/aIL4blT/T6k75VJuf/oGFQk= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98 h1:i81pfVEIkl0zoCA0snPfvW9AvmNryP44i2V7i+FX0Qw= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98/go.mod h1:Rj+ITkyYPNy/Da6qeFsbihCZvo7edX6NVIGMYbE/GB8= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415062639-0a20c33da5ed h1:u5ddlUV71HZLjdlQTq54ETcO2a6ssnt5ZEpUSzHFJsE= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415062639-0a20c33da5ed/go.mod h1:AL6MHlRkDC3FOcSBD+MJM2Ntin4gFAf9ozRNeXOMKn4= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -186,6 +190,8 @@ github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b h1:X8IJgQ github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200210170912-d6136d2dca3b/go.mod h1:E4pVqEHsZsiEBuLviZcr417ED0VoSVraFhLPSPsMvGQ= github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc h1:W7k2JllS7w4H2trNbmDFAfrKlclbZ5dV3V7abJZ7fz0= github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc/go.mod h1:+Ls63IIPcQ0EC0rIwQewMaRvY/uDpR0XluNj8jRTHWA= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200415062547-f2b463a0f478 h1:VUv74I8c7mv8YpQqd6B/4LTuyhQv2VXkPef6qkNpwio= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200415062547-f2b463a0f478/go.mod h1:eBdaTjRcALUkkAQ7uKwC3Ad041igA0oSmiOsgbRPBgw= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= From 49689ea613b9b74402054a29e4b27955b6fa86fb Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 17 Apr 2020 00:15:10 +0530 Subject: [PATCH 16/32] finish host changes --- go.mod | 11 ++++++----- go.sum | 19 +++++++++++++++++++ introspect_test.go | 20 ++++++++++++++------ p2p/host/basic/basic_host.go | 2 +- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index aa1df65b41..0d4adfa677 100644 --- a/go.mod +++ b/go.mod @@ -11,20 +11,20 @@ require ( github.com/jbenet/go-cienv v0.1.0 github.com/jbenet/goprocess v0.1.3 github.com/libp2p/go-conn-security-multistream v0.1.0 - github.com/libp2p/go-eventbus v0.1.0 + github.com/libp2p/go-eventbus v0.1.1-0.20200416170853-60bdfbaef67b github.com/libp2p/go-libp2p-autonat v0.1.1 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.4 - github.com/libp2p/go-libp2p-core v0.3.2-0.20200415062127-fcc117eae71a + github.com/libp2p/go-libp2p-core v0.3.2-0.20200416180009-086efa616a18 github.com/libp2p/go-libp2p-discovery v0.2.0 - github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415062639-0a20c33da5ed + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200416180817-cea9c00b93b6 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.5 github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.1.4 github.com/libp2p/go-libp2p-secio v0.2.1 - github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200415062547-f2b463a0f478 + github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200416170506-690b776aa519 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 github.com/libp2p/go-libp2p-yamux v0.2.1 @@ -33,7 +33,7 @@ require ( github.com/libp2p/go-tcp-transport v0.1.1 github.com/libp2p/go-ws-transport v0.2.0 github.com/miekg/dns v1.1.12 // indirect - github.com/multiformats/go-multiaddr v0.2.0 + github.com/multiformats/go-multiaddr v0.2.1 github.com/multiformats/go-multiaddr-dns v0.2.0 github.com/multiformats/go-multiaddr-net v0.1.2 github.com/multiformats/go-multistream v0.1.1 @@ -43,4 +43,5 @@ require ( golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect ) + go 1.12 diff --git a/go.sum b/go.sum index 47cca384c2..5c22d19614 100644 --- a/go.sum +++ b/go.sum @@ -61,6 +61,8 @@ github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvK github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -134,6 +136,8 @@ github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= github.com/libp2p/go-eventbus v0.1.0 h1:mlawomSAjjkk97QnYiEmHsLu7E136+2oCWSHRUvMfzQ= github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= +github.com/libp2p/go-eventbus v0.1.1-0.20200416170853-60bdfbaef67b h1:cYwsEFu9D8lUNyWCgzq0RUDTr4iHlwJFcwXjHXus9qM= +github.com/libp2p/go-eventbus v0.1.1-0.20200416170853-60bdfbaef67b/go.mod h1:Hqak/t7SFu+kL4dS4NBJx2uLqZSHJRApP2KPEglh4vM= github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= @@ -156,6 +160,10 @@ github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b h1:/q9bdQK github.com/libp2p/go-libp2p-core v0.3.2-0.20200414114438-d47936597d5b/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-core v0.3.2-0.20200415062127-fcc117eae71a h1:ijScFHS86L0LYjaagrxxinbsd1HIniHSKB2vFobmJ5s= github.com/libp2p/go-libp2p-core v0.3.2-0.20200415062127-fcc117eae71a/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200416170247-0a7a9856715c h1:IYaFZg3eDAGtXS32hN8qZ/QFbal9+ASqZuNOnyRkV3g= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200416170247-0a7a9856715c/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200416180009-086efa616a18 h1:ZNi+KgvFvYwc2MY4tQeVu49Wjk3or/ahnKDURZGl2V4= +github.com/libp2p/go-libp2p-core v0.3.2-0.20200416180009-086efa616a18/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= @@ -166,6 +174,10 @@ github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98 h1 github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415054041-02b3298abb98/go.mod h1:Rj+ITkyYPNy/Da6qeFsbihCZvo7edX6NVIGMYbE/GB8= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415062639-0a20c33da5ed h1:u5ddlUV71HZLjdlQTq54ETcO2a6ssnt5ZEpUSzHFJsE= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200415062639-0a20c33da5ed/go.mod h1:AL6MHlRkDC3FOcSBD+MJM2Ntin4gFAf9ozRNeXOMKn4= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200416171317-fe15dfd96ef8 h1:Tw6Dsr5ZcEHBKajJNleNS9dl6SE2wkhzXMSdQyE9Rcc= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200416171317-fe15dfd96ef8/go.mod h1:KSG8+45+ykFGfibkrViy/9/tVEOiWBAxOUF5lr2bS5k= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200416180817-cea9c00b93b6 h1:SvlhN0Y7GV0CWrdYbg2S2DVVrHkWWtrXvMKDgePA55w= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200416180817-cea9c00b93b6/go.mod h1:H0TlHJWPcA4U1RVt0MtPkt69Ibvhxyn1vc8Wzebdujg= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -192,6 +204,8 @@ github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc h1:W7k2Jl github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200414115316-45c69b9f86bc/go.mod h1:+Ls63IIPcQ0EC0rIwQewMaRvY/uDpR0XluNj8jRTHWA= github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200415062547-f2b463a0f478 h1:VUv74I8c7mv8YpQqd6B/4LTuyhQv2VXkPef6qkNpwio= github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200415062547-f2b463a0f478/go.mod h1:eBdaTjRcALUkkAQ7uKwC3Ad041igA0oSmiOsgbRPBgw= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200416170506-690b776aa519 h1:WQeHcX3Em9E5MwbaGWqI3g62CtYvo4sTJTj3EWOZZCo= +github.com/libp2p/go-libp2p-swarm v0.2.3-0.20200416170506-690b776aa519/go.mod h1:rS8JNJqHO3CCLkkGfct1LGuOfQjdVrH+d82+mWYKVXE= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= @@ -267,6 +281,8 @@ github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lg github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0 h1:lR52sFwcTCuQb6bTfnXF6zA2XfyYvyd+5a9qECv/J90= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= +github.com/multiformats/go-multiaddr v0.2.1 h1:SgG/cw5vqyB5QQe5FPe2TqggU9WtrA9X4nZw7LlVqOI= +github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= @@ -291,6 +307,7 @@ github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wS github.com/multiformats/go-multistream v0.1.1 h1:JlAdpIFhBhGRLxe9W6Om0w++Gd6KMWoFPZL/dEnm9nI= github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -349,6 +366,8 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= diff --git a/introspect_test.go b/introspect_test.go index b8d8d3df99..b881835132 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -160,18 +160,26 @@ func TestIntrospector(t *testing.T) { require.NoError(connection.WriteMessage(websocket.BinaryMessage, bz)) time.Sleep(1 * time.Second) - // We get a state message when we unpause + // We get a runtime and state message when we unpause cl = &introspection_pb.ClientSignal{Signal: introspection_pb.ClientSignal_UNPAUSE_PUSH_EMITTER} bz, err = proto.Marshal(cl) require.NoError(err) require.NotEmpty(bz) require.NoError(connection.WriteMessage(websocket.BinaryMessage, bz)) - time.Sleep(1 * time.Second) - pd = fetchProtocolWrapper(require, connection) - st = pd.GetState() - require.NotNil(t, st) - assertState(require, st, h1, h2, h3, true) + require.Eventually(func() bool { + pd = fetchProtocolWrapper(require, connection) + + return pd.GetRuntime() != nil && pd.GetState() == nil + }, 10*time.Second, 1*time.Second) + + require.Eventually(func() bool { + pd = fetchProtocolWrapper(require, connection) + + return pd.GetState() != nil && pd.GetRuntime() == nil + }, 10*time.Second, 1*time.Second) + + assertState(require, pd.GetState(), h1, h2, h3, true) } func assertState(require *require.Assertions, state *introspection_pb.State, h1, h2, h3 host.Host, diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 58b1e9de8f..1cb772e6f1 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -215,7 +215,7 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo } if h.introspectionEndpoint != nil { - if err := h.introspectionEndpoint.Start(); err != nil { + if err := h.introspectionEndpoint.Start(h.eventbus); err != nil { return nil, fmt.Errorf("failed to start introspection endpoint: %w", err) } } From cc7b8418020eea5be7373b376be7496140064aa7 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 17 Apr 2020 11:22:45 +0530 Subject: [PATCH 17/32] finished chages --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0d4adfa677..08e7780a8e 100644 --- a/go.mod +++ b/go.mod @@ -44,4 +44,4 @@ require ( ) -go 1.12 +go 1.12 \ No newline at end of file From 00fa2867aee227c9b7571660756606d123bb4672 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 17 Apr 2020 14:03:28 +0530 Subject: [PATCH 18/32] upgraded introspector --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 114426b52e..30a62c8634 100644 --- a/go.mod +++ b/go.mod @@ -14,9 +14,9 @@ require ( github.com/libp2p/go-libp2p-autonat v0.2.2 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.2.1 - github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d + github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f github.com/libp2p/go-libp2p-discovery v0.3.0 - github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930 + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 diff --git a/go.sum b/go.sum index 490d3f2b0f..bd88acfadf 100644 --- a/go.sum +++ b/go.sum @@ -189,6 +189,8 @@ github.com/libp2p/go-libp2p-core v0.5.1 h1:6Cu7WljPQtGY2krBlMoD8L/zH3tMUsCbqNFH7 github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d h1:ig8zIKt/shtRBOZqaEsJ/GX+LEpxqJ3CfIk0dKciZXI= github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f h1:gOu3iEE2lxXDOucfRkn6dx0S8T9zpYAedSZuO0f81Jc= +github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= @@ -197,6 +199,8 @@ github.com/libp2p/go-libp2p-discovery v0.3.0 h1:+JnYBRLzZQtRq0mK3xhyjBwHytLmJXMT github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930 h1:1mXvz+hJXdTEge0MkJYR1UqI4a4hB7p+AdWzpul13g0= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930/go.mod h1:1HwKb2Qa9wg0T5gKyB5MkNHIs4SOIim8oQ0htYmp5G4= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5 h1:797Avl9vd4jgNJ6qLjXKaoCK+QDhADnVwT48niPocwY= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= From a6300bc7b537565d87eb92847385b87c11d75c11 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 17 Apr 2020 18:55:14 +0530 Subject: [PATCH 19/32] change encoding of messages --- go.mod | 2 +- go.sum | 2 ++ introspect_test.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 30a62c8634..74b2c46cf1 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/libp2p/go-libp2p-circuit v0.2.1 github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f github.com/libp2p/go-libp2p-discovery v0.3.0 - github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5 + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 diff --git a/go.sum b/go.sum index bd88acfadf..d8a87ec7ef 100644 --- a/go.sum +++ b/go.sum @@ -201,6 +201,8 @@ github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930 h1 github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930/go.mod h1:1HwKb2Qa9wg0T5gKyB5MkNHIs4SOIim8oQ0htYmp5G4= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5 h1:797Avl9vd4jgNJ6qLjXKaoCK+QDhADnVwT48niPocwY= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36 h1:sk0Q1Rm0kMwsBLzQeviGnVAvLyRsS4uJhEXdHAocQjs= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= diff --git a/introspect_test.go b/introspect_test.go index b881835132..228f2074d5 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -253,7 +253,7 @@ func fetchProtocolWrapper(require *require.Assertions, conn *websocket.Conn) *in require.NoError(err) require.NotEmpty(msg) pd := &introspection_pb.ProtocolDataPacket{} - require.NoError(proto.Unmarshal(msg, pd)) + require.NoError(proto.Unmarshal(msg[12:], pd)) require.NotNil(pd.Message) require.Equal(introspection.ProtoVersion, pd.Version.Version) return pd From b31732835e10232fa7bd1518ea4ee7d1084afc6b Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Thu, 23 Apr 2020 14:30:39 +0530 Subject: [PATCH 20/32] swarm should send 0 traffic for now --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 74b2c46cf1..d7cb1ed664 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.2.2 github.com/libp2p/go-libp2p-secio v0.2.2 - github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f + github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-tls v0.1.3 github.com/libp2p/go-libp2p-transport-upgrader v0.2.0 diff --git a/go.sum b/go.sum index d8a87ec7ef..46e9cba5cb 100644 --- a/go.sum +++ b/go.sum @@ -241,6 +241,8 @@ github.com/libp2p/go-libp2p-swarm v0.2.3 h1:uVkCb8Blfg7HQ/f30TyHn1g/uCwXsAET7pU0 github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f h1:LX+udu+3auqLiYpHrd1+MXOdMNTfB4PRtIO0++pbadM= github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= +github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b h1:ZjdUXxKjtOH22t5UGfHY/lb/avP2lUO7OVJ6f9y4MPQ= +github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= From dc74d13909c317e586290f063dbb0e6652ff3abf Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 24 Apr 2020 14:56:14 +0530 Subject: [PATCH 21/32] timestamping changes --- go.mod | 6 +++--- go.sum | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d7cb1ed664..4e5eaf116a 100644 --- a/go.mod +++ b/go.mod @@ -14,16 +14,16 @@ require ( github.com/libp2p/go-libp2p-autonat v0.2.2 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.2.1 - github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f + github.com/libp2p/go-libp2p-core v0.5.2-0.20200424084047-616e011e7e9d github.com/libp2p/go-libp2p-discovery v0.3.0 - github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36 + github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200424091613-bee588f5a69a github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.2.2 github.com/libp2p/go-libp2p-secio v0.2.2 - github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b + github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-tls v0.1.3 github.com/libp2p/go-libp2p-transport-upgrader v0.2.0 diff --git a/go.sum b/go.sum index 46e9cba5cb..522e9fb4c2 100644 --- a/go.sum +++ b/go.sum @@ -191,6 +191,8 @@ github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d h1:ig8zIKt github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f h1:gOu3iEE2lxXDOucfRkn6dx0S8T9zpYAedSZuO0f81Jc= github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-core v0.5.2-0.20200424084047-616e011e7e9d h1:Iwq/F910sPQYfKl8npFFoSxKSzVBNTJyPVTLTcRQX6U= +github.com/libp2p/go-libp2p-core v0.5.2-0.20200424084047-616e011e7e9d/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= @@ -203,6 +205,8 @@ github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5 h1 github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36 h1:sk0Q1Rm0kMwsBLzQeviGnVAvLyRsS4uJhEXdHAocQjs= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200424091613-bee588f5a69a h1:sIVnxpkIk1HwBUAPI2ol4ZfQI/iBBInUONSXxJI5WM4= +github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200424091613-bee588f5a69a/go.mod h1:79Zu1U1kqQDW244H+jbJuqshCoM/KxM4UY9csaEivzE= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= @@ -243,6 +247,8 @@ github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f h1:LX+udu github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b h1:ZjdUXxKjtOH22t5UGfHY/lb/avP2lUO7OVJ6f9y4MPQ= github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= +github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7 h1:Q8wkt0XSGZM38vb5ZNDVQhLGczVsxCqaSKDPP46GLZA= +github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7/go.mod h1:6ey/hj9XGMjFpET2LIEx9mGog/KMJXuswwjRUUVy/CE= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= From 4a4c3bc5212bc102fe63b101559f39ef14171e73 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 24 Apr 2020 17:38:00 +0530 Subject: [PATCH 22/32] fix conn issue --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4e5eaf116a..b4c84eae42 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peerstore v0.2.2 github.com/libp2p/go-libp2p-secio v0.2.2 - github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7 + github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424120434-6a7bedc68235 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-tls v0.1.3 github.com/libp2p/go-libp2p-transport-upgrader v0.2.0 diff --git a/go.sum b/go.sum index 522e9fb4c2..7f4e27df7f 100644 --- a/go.sum +++ b/go.sum @@ -249,6 +249,8 @@ github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b h1:ZjdUXx github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7 h1:Q8wkt0XSGZM38vb5ZNDVQhLGczVsxCqaSKDPP46GLZA= github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7/go.mod h1:6ey/hj9XGMjFpET2LIEx9mGog/KMJXuswwjRUUVy/CE= +github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424120434-6a7bedc68235 h1:cg4+M9pxEyp07UJAU5vQ18NsKxDnJJLS9rh/g7LqyLg= +github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424120434-6a7bedc68235/go.mod h1:6ey/hj9XGMjFpET2LIEx9mGog/KMJXuswwjRUUVy/CE= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= From 0b8a0e53fb2a75e5c49011a3d4b2a6569721decf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 4 Jun 2020 17:24:47 +0100 Subject: [PATCH 23/32] update introspector and ws endpoint. --- config/config.go | 8 +- config/constructor_types.go | 10 +- go.mod | 33 +- go.sum | 315 ++++++++++++------ introspect/default_inspector.go | 234 ++++++++++++++ introspect/default_inspector_test.go | 112 +++++++ introspect/event_manager.go | 194 ++++++++++++ introspect/event_manager_test.go | 149 +++++++++ introspect/mock_inspector.go | 39 +++ introspect/ws/server.go | 346 ++++++++++++++++++++ introspect/ws/server_common_test.go | 95 ++++++ introspect/ws/server_config_test.go | 90 ++++++ introspect/ws/server_hello_test.go | 56 ++++ introspect/ws/server_lifecycle_test.go | 53 ++++ introspect/ws/server_push_test.go | 137 ++++++++ introspect/ws/server_request_test.go | 64 ++++ introspect/ws/session.go | 422 +++++++++++++++++++++++++ introspect_test.go | 4 +- options.go | 8 +- p2p/host/basic/basic_host.go | 47 ++- p2p/net/mock/mock_conn.go | 11 + p2p/net/mock/mock_stream.go | 9 + 22 files changed, 2285 insertions(+), 151 deletions(-) create mode 100644 introspect/default_inspector.go create mode 100644 introspect/default_inspector_test.go create mode 100644 introspect/event_manager.go create mode 100644 introspect/event_manager_test.go create mode 100644 introspect/mock_inspector.go create mode 100644 introspect/ws/server.go create mode 100644 introspect/ws/server_common_test.go create mode 100644 introspect/ws/server_config_test.go create mode 100644 introspect/ws/server_hello_test.go create mode 100644 introspect/ws/server_lifecycle_test.go create mode 100644 introspect/ws/server_push_test.go create mode 100644 introspect/ws/server_request_test.go create mode 100644 introspect/ws/session.go diff --git a/config/config.go b/config/config.go index 0fdbc89b4c..4c999b7c43 100644 --- a/config/config.go +++ b/config/config.go @@ -47,7 +47,7 @@ type NATManagerC func(network.Network) bhost.NATManager type RoutingC func(host.Host) (routing.PeerRouting, error) -// IntrospectionEndpointC is a type that represents an introspection.Endpoint +// IntrospectionEndpointC is a type that represents an introspect.Endpoint // constructor. type IntrospectionEndpointC func(introspection.Introspector) (introspection.Endpoint, error) @@ -137,7 +137,7 @@ func (cfg *Config) makeSwarm(ctx context.Context) (*swarm.Swarm, error) { } // TODO: Make the swarm implementation configurable. - swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter, cfg.Introspector) + swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter) if cfg.Filters != nil { swrm.Filters = cfg.Filters } @@ -152,7 +152,7 @@ func (cfg *Config) addTransports(ctx context.Context, h host.Host) (err error) { } upgrader := new(tptu.Upgrader) upgrader.PSK = cfg.PSK - upgrader.Filters = cfg.Filters + //upgrader.Filters = cfg.Filters if cfg.Insecure { upgrader.Secure = makeInsecureTransport(h.ID(), cfg.PeerKey) } else { @@ -211,7 +211,7 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { opts.IntrospectionEndpoint, err = cfg.IntrospectionEndpoint(cfg.Introspector) if err != nil { swrm.Close() - return nil, fmt.Errorf("failed while starting introspection endpoint: %w", err) + return nil, fmt.Errorf("failed while starting introspect endpoint: %w", err) } } diff --git a/config/constructor_types.go b/config/constructor_types.go index ea2b71b468..6b5e57c0c7 100644 --- a/config/constructor_types.go +++ b/config/constructor_types.go @@ -43,11 +43,11 @@ var argTypes = map[reflect.Type]constructor{ muxType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Muxer }, securityType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Secure }, pskType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.PSK }, - filtersType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Filters }, - peerIDType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.ID() }, - privKeyType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore().PrivKey(h.ID()) }, - pubKeyType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore().PubKey(h.ID()) }, - pstoreType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore() }, + //filtersType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Filters }, + peerIDType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.ID() }, + privKeyType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore().PrivKey(h.ID()) }, + pubKeyType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore().PubKey(h.ID()) }, + pstoreType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore() }, } func newArgTypeSet(types ...reflect.Type) map[reflect.Type]constructor { diff --git a/go.mod b/go.mod index b4c84eae42..0acf740ce1 100644 --- a/go.mod +++ b/go.mod @@ -1,43 +1,54 @@ module github.com/libp2p/go-libp2p require ( + github.com/benbjohnson/clock v1.0.2 + github.com/davecgh/go-spew v1.1.1 github.com/gogo/protobuf v1.3.1 github.com/gorilla/websocket v1.4.2 github.com/ipfs/go-cid v0.0.5 github.com/ipfs/go-detect-race v0.0.1 github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v1.0.3 + github.com/ipfs/go-log v1.0.4 + github.com/ipfs/go-log/v2 v2.0.5 github.com/jbenet/go-cienv v0.1.0 github.com/jbenet/goprocess v0.1.4 - github.com/libp2p/go-conn-security-multistream v0.1.0 + github.com/libp2p/go-conn-security-multistream v0.2.0 github.com/libp2p/go-eventbus v0.1.1-0.20200417061519-63254f6c0da4 github.com/libp2p/go-libp2p-autonat v0.2.2 github.com/libp2p/go-libp2p-blankhost v0.1.4 - github.com/libp2p/go-libp2p-circuit v0.2.1 - github.com/libp2p/go-libp2p-core v0.5.2-0.20200424084047-616e011e7e9d + github.com/libp2p/go-libp2p-circuit v0.2.3 + github.com/libp2p/go-libp2p-core v0.5.7 github.com/libp2p/go-libp2p-discovery v0.3.0 github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200424091613-bee588f5a69a github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 github.com/libp2p/go-libp2p-netutil v0.1.0 - github.com/libp2p/go-libp2p-peerstore v0.2.2 + github.com/libp2p/go-libp2p-peerstore v0.2.4 github.com/libp2p/go-libp2p-secio v0.2.2 github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424120434-6a7bedc68235 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-tls v0.1.3 - github.com/libp2p/go-libp2p-transport-upgrader v0.2.0 - github.com/libp2p/go-libp2p-yamux v0.2.7 + github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 + github.com/libp2p/go-libp2p-yamux v0.2.8 github.com/libp2p/go-maddr-filter v0.0.5 - github.com/libp2p/go-stream-muxer-multistream v0.2.0 + github.com/libp2p/go-stream-muxer-multistream v0.3.0 github.com/libp2p/go-tcp-transport v0.2.0 github.com/libp2p/go-ws-transport v0.3.0 - github.com/multiformats/go-multiaddr v0.2.1 + github.com/multiformats/go-multiaddr v0.2.2 github.com/multiformats/go-multiaddr-dns v0.2.0 - github.com/multiformats/go-multiaddr-net v0.1.4 + github.com/multiformats/go-multiaddr-net v0.1.5 github.com/multiformats/go-multistream v0.1.1 - github.com/stretchr/testify v1.5.1 + github.com/stretchr/testify v1.6.0 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 + go.uber.org/zap v1.14.1 + golang.org/x/net v0.0.0-20190923162816-aa69164e4478 ) +replace github.com/libp2p/go-libp2p-core => ../go-libp2p-core + +replace github.com/libp2p/go-libp2p-swarm => ../go-libp2p-swarm + +replace github.com/libp2p/go-eventbus => ../go-eventbus + go 1.12 diff --git a/go.sum b/go.sum index 7f4e27df7f..cabd8ab4eb 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,44 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= +dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= +dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= +dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= +git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/benbjohnson/clock v1.0.2 h1:Z0CN0Yb4ig9sGPXkvAQcGJfnrrMQ5QYLCMPRi9iD7YE= +github.com/benbjohnson/clock v1.0.2/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -32,43 +47,69 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 h1:6xT9KW8zLC5IlbaIF5Q7JNieBoACT7iW0YTxQHR0in0= github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= +github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU= +github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gopacket v1.1.17 h1:rMrlX2ZY2UbvT+sdz3+6J+pp2z+msCq9MxTU6ymxbBY= github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= +github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -81,10 +122,7 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-cid v0.0.5 h1:o0Ix8e/ql7Zb5UVUJEUfjsWCIY8t48++9lR8qi6oiJU= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= @@ -94,10 +132,11 @@ github.com/ipfs/go-datastore v0.4.4/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13X github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE= +github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= github.com/ipfs/go-ds-leveldb v0.4.1/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= +github.com/ipfs/go-ds-leveldb v0.4.2/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= @@ -107,11 +146,15 @@ github.com/ipfs/go-log v1.0.2 h1:s19ZwJxH8rPWzypjcDpqPLIyV7BnbLqvpli3iZoqYK0= github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk= github.com/ipfs/go-log v1.0.3 h1:Gg7SUYSZ7BrqaKMwM+hRgcAkKv4QLfzP4XPQt5Sx/OI= github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= +github.com/ipfs/go-log v1.0.4 h1:6nLQdX4W8P9yZZFH7mO+X/PzjN8Laozm/lMJ6esdgzY= +github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs= github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.2 h1:xguurydRdfKMJjKyxNXNU8lYP0VZH1NUwJRwUorjuEw= github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.3 h1:Q2gXcBoCALyLN/pUQlz1qgu0x3uFV6FzP9oXhpfyJpc= github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= +github.com/ipfs/go-log/v2 v2.0.5 h1:fL4YI+1g5V/b1Yxr1qAiXTMg1H8z9vx/VmJxBuQMHvU= +github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= @@ -123,39 +166,43 @@ github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= +github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= +github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= +github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= +github.com/libp2p/go-addr-util v0.0.2 h1:7cWK5cdA5x72jX0g8iLrQWm5TRJZ6CzGdPEhWj7plWU= +github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-eventbus v0.1.0 h1:mlawomSAjjkk97QnYiEmHsLu7E136+2oCWSHRUvMfzQ= -github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= -github.com/libp2p/go-eventbus v0.1.1-0.20200417061519-63254f6c0da4 h1:m6ax5Jpc3XCVSs5sPRKsNqI7Zo03dz7u6ndUOFiNqnA= -github.com/libp2p/go-eventbus v0.1.1-0.20200417061519-63254f6c0da4/go.mod h1:6I+OKIbCq7cIh7X7wDxGGRcEYnsTJfcqg2i0HEIetqc= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= +github.com/libp2p/go-conn-security-multistream v0.2.0 h1:uNiDjS58vrvJTg9jO6bySd1rMKejieG7v45ekqHbZ1M= +github.com/libp2p/go-conn-security-multistream v0.2.0/go.mod h1:hZN4MjlNetKD3Rq5Jb/P5ohUnFLNzEAR4DLSzpn2QLU= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZkfEI5sT54= @@ -175,36 +222,14 @@ github.com/libp2p/go-libp2p-circuit v0.1.4 h1:Phzbmrg3BkVzbqd4ZZ149JxCuUWu2wZcXf github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= github.com/libp2p/go-libp2p-circuit v0.2.1 h1:BDiBcQxX/ZJJ/yDl3sqZt1bjj4PkZCEi7IEpwxXr13k= github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= -github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= -github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= -github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= -github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= -github.com/libp2p/go-libp2p-core v0.3.1/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= -github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= -github.com/libp2p/go-libp2p-core v0.5.0 h1:FBQ1fpq2Fo/ClyjojVJ5AKXlKhvNc/B6U0O+7AN1ffE= -github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= -github.com/libp2p/go-libp2p-core v0.5.1 h1:6Cu7WljPQtGY2krBlMoD8L/zH3tMUsCbqNFH7cZwCoI= -github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d h1:ig8zIKt/shtRBOZqaEsJ/GX+LEpxqJ3CfIk0dKciZXI= -github.com/libp2p/go-libp2p-core v0.5.2-0.20200417060929-6957bf8a421d/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f h1:gOu3iEE2lxXDOucfRkn6dx0S8T9zpYAedSZuO0f81Jc= -github.com/libp2p/go-libp2p-core v0.5.2-0.20200417081628-b224967ed43f/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.2-0.20200424084047-616e011e7e9d h1:Iwq/F910sPQYfKl8npFFoSxKSzVBNTJyPVTLTcRQX6U= -github.com/libp2p/go-libp2p-core v0.5.2-0.20200424084047-616e011e7e9d/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-circuit v0.2.3 h1:3Uw1fPHWrp1tgIhBz0vSOxRUmnKL8L/NGUyEd5WfSGM= +github.com/libp2p/go-libp2p-circuit v0.2.3/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J6rWBEfz/aiY= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= github.com/libp2p/go-libp2p-discovery v0.3.0 h1:+JnYBRLzZQtRq0mK3xhyjBwHytLmJXMTZkQfbw+UrGA= github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= -github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930 h1:1mXvz+hJXdTEge0MkJYR1UqI4a4hB7p+AdWzpul13g0= -github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417062351-cc3f2009f930/go.mod h1:1HwKb2Qa9wg0T5gKyB5MkNHIs4SOIim8oQ0htYmp5G4= -github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5 h1:797Avl9vd4jgNJ6qLjXKaoCK+QDhADnVwT48niPocwY= -github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417083205-a06bfb6943a5/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= -github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36 h1:sk0Q1Rm0kMwsBLzQeviGnVAvLyRsS4uJhEXdHAocQjs= -github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200417131537-34bb938a0e36/go.mod h1:gvjETXJqso3qHnUgtL6YQKTU5W1P1xad5dKFLOKE0gs= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200424091613-bee588f5a69a h1:sIVnxpkIk1HwBUAPI2ol4ZfQI/iBBInUONSXxJI5WM4= github.com/libp2p/go-libp2p-introspector v0.0.5-0.20200424091613-bee588f5a69a/go.mod h1:79Zu1U1kqQDW244H+jbJuqshCoM/KxM4UY9csaEivzE= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= @@ -223,37 +248,23 @@ github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLK github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= github.com/libp2p/go-libp2p-peerstore v0.2.0 h1:XcgJhI8WyUOCbHyRLNEX5542YNj8hnLSJ2G1InRjDhk= github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ= github.com/libp2p/go-libp2p-peerstore v0.2.1 h1:u+gOfsKgu73ZkGWhvckRm03z9C+iS9TrLqpANweELGs= github.com/libp2p/go-libp2p-peerstore v0.2.1/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= github.com/libp2p/go-libp2p-peerstore v0.2.2 h1:iqc/m03jHn5doXN3+kS6JKvqQRHEltiXljQB85iVHWE= github.com/libp2p/go-libp2p-peerstore v0.2.2/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= +github.com/libp2p/go-libp2p-peerstore v0.2.4 h1:jU9S4jYN30kdzTpDAR7SlHUD+meDUjTODh4waLWF1ws= +github.com/libp2p/go-libp2p-peerstore v0.2.4/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= +github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M= github.com/libp2p/go-libp2p-secio v0.2.1 h1:eNWbJTdyPA7NxhP7J3c5lT97DC5d+u+IldkgCYFTPVA= github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= github.com/libp2p/go-libp2p-secio v0.2.2 h1:rLLPvShPQAcY6eNurKNZq3eZjPWfU9kXF2eI9jIYdrg= github.com/libp2p/go-libp2p-secio v0.2.2/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncHG0uVwGrwvjYlNY= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-swarm v0.2.2 h1:T4hUpgEs2r371PweU3DuH7EOmBIdTBCwWs+FLcgx3bQ= -github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= -github.com/libp2p/go-libp2p-swarm v0.2.3 h1:uVkCb8Blfg7HQ/f30TyHn1g/uCwXsAET7pU0U59gx/A= -github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f h1:LX+udu+3auqLiYpHrd1+MXOdMNTfB4PRtIO0++pbadM= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200417062831-28eda91e270f/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b h1:ZjdUXxKjtOH22t5UGfHY/lb/avP2lUO7OVJ6f9y4MPQ= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200423085602-109ffd0eb55b/go.mod h1:G6UrNovm3+thMwE2MU8xCw5v2Ov1eZOp+zcmv4aU6aI= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7 h1:Q8wkt0XSGZM38vb5ZNDVQhLGczVsxCqaSKDPP46GLZA= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424085444-7b9bdba85bd7/go.mod h1:6ey/hj9XGMjFpET2LIEx9mGog/KMJXuswwjRUUVy/CE= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424120434-6a7bedc68235 h1:cg4+M9pxEyp07UJAU5vQ18NsKxDnJJLS9rh/g7LqyLg= -github.com/libp2p/go-libp2p-swarm v0.2.4-0.20200424120434-6a7bedc68235/go.mod h1:6ey/hj9XGMjFpET2LIEx9mGog/KMJXuswwjRUUVy/CE= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-testing v0.1.1 h1:U03z3HnGI7Ni8Xx6ONVZvUFOAzWYmolWf5W5jAOPNmU= github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= @@ -262,12 +273,15 @@ github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40s github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= github.com/libp2p/go-libp2p-transport-upgrader v0.2.0 h1:5EhPgQhXZNyfL22ERZTUoVp9UVVbNowWNVtELQaKCHk= github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= +github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 h1:q3ULhsknEQ34eVDhv4YwKS8iet69ffs9+Fir6a7weN4= +github.com/libp2p/go-libp2p-transport-upgrader v0.3.0/go.mod h1:i+SKzbRnvXdVbU3D1dwydnTmKRPXiAR/fyvi1dXuL4o= github.com/libp2p/go-libp2p-yamux v0.2.2/go.mod h1:lIohaR0pT6mOt0AZ0L2dFze9hds9Req3OfS+B+dv4qw= github.com/libp2p/go-libp2p-yamux v0.2.5 h1:MuyItOqz03oi8npvjgMJxgnhllJLZnO/dKVOpTZ9+XI= github.com/libp2p/go-libp2p-yamux v0.2.5/go.mod h1:Zpgj6arbyQrmZ3wxSZxfBmbdnWtbZ48OpsfmQVTErwA= github.com/libp2p/go-libp2p-yamux v0.2.7 h1:vzKu0NVtxvEIDGCv6mjKRcK0gipSgaXmJZ6jFv0d/dk= github.com/libp2p/go-libp2p-yamux v0.2.7/go.mod h1:X28ENrBMU/nm4I3Nx4sZ4dgjZ6VhLEn0XhIoZ5viCwU= +github.com/libp2p/go-libp2p-yamux v0.2.8 h1:0s3ELSLu2O7hWKfX1YjzudBKCP0kZ+m9e2+0veXzkn4= +github.com/libp2p/go-libp2p-yamux v0.2.8/go.mod h1:/t6tDqeuZf0INZMTgd0WxIRbtK2EzI2h7HbFm9eAKI4= github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= github.com/libp2p/go-maddr-filter v0.0.5 h1:CW3AgbMO6vUvT4kf87y4N+0P8KUl2aqLYhrGyDUbLSg= github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M= @@ -277,7 +291,6 @@ github.com/libp2p/go-mplex v0.1.1 h1:huPH/GGRJzmsHR9IZJJsrSwIM5YE2gL4ssgl1YWb/ps github.com/libp2p/go-mplex v0.1.1/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk= github.com/libp2p/go-mplex v0.1.2 h1:qOg1s+WdGLlpkrczDqmhYzyk3vCfsQ8+RxRTQjOZWwI= github.com/libp2p/go-mplex v0.1.2/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.4 h1:agEFehY3zWJFUHK6SEMR7UYmk2z6kC3oeCM7ybLhguA= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-nat v0.0.4 h1:KbizNnq8YIf7+Hn7+VFL/xE0eDrkPru2zIO9NMwL8UQ= @@ -286,10 +299,8 @@ github.com/libp2p/go-nat v0.0.5 h1:qxnwkco8RLKqVh1NmjQ+tJ8p8khNLFxuElYG/TwqW4Q= github.com/libp2p/go-nat v0.0.5/go.mod h1:B7NxsVNPZmRLvMOwiEO1scOSyjA56zxYAGv1yQgRkEU= github.com/libp2p/go-netroute v0.1.2 h1:UHhB35chwgvcRI392znJA3RCBtZ3MpE3ahNCN5MR4Xg= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= -github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.4 h1:d27YZvLoTyMhIN4njrkr8zMDOM4lfpHIp6A+TK9fovg= -github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= +github.com/libp2p/go-openssl v0.0.5 h1:pQkejVhF0xp08D4CQUcw8t+BFJeXowja6RVcb5p++EA= +github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= @@ -301,7 +312,8 @@ github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2L github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= +github.com/libp2p/go-stream-muxer-multistream v0.3.0 h1:TqnSHPJEIqDEO7h1wZZ0p3DXdvDSiLHQidKKUGZtiOY= +github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= github.com/libp2p/go-tcp-transport v0.1.1 h1:yGlqURmqgNA2fvzjSgZNlHcsd/IulAnKM8Ncu+vlqnw= github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= github.com/libp2p/go-tcp-transport v0.2.0 h1:YoThc549fzmNJIh7XjHVtMIFaEDRtIrtWciG5LyYAPo= @@ -310,20 +322,23 @@ github.com/libp2p/go-ws-transport v0.2.0 h1:MJCw2OrPA9+76YNRvdo1wMnSOxb9Bivj6sVF github.com/libp2p/go-ws-transport v0.2.0/go.mod h1:9BHJz/4Q5A9ludYWKoGCFC5gUElzlHoKzu0yY9p/klM= github.com/libp2p/go-ws-transport v0.3.0 h1:mjo6pL5aVR9rCjl9wNq3DupbaQlyR61pzoOT2MdtxaA= github.com/libp2p/go-ws-transport v0.3.0/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.0/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.3 h1:mWuzZRCAeTBFdynLlsYgA/EIeMOLr8XY04wa52NRhsE= github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.5 h1:ibuz4naPAully0pN6J/kmUARiqLpnDQIzI/8GCOrljg= github.com/libp2p/go-yamux v1.3.5/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= +github.com/libp2p/go-yamux v1.3.7 h1:v40A1eSPJDIZwz2AvrV3cxpTZEGDP11QJbukmEhYyQI= +github.com/libp2p/go-yamux v1.3.7/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= +github.com/lucas-clemente/quic-go v0.16.0/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= +github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= +github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.28 h1:gQhy5bsJa8zTlVI8lywCTZp1lguor+xevFoYlzeCTQY= github.com/miekg/dns v1.1.28/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= @@ -331,14 +346,14 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -352,11 +367,11 @@ github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.2.1 h1:SgG/cw5vqyB5QQe5FPe2TqggU9WtrA9X4nZw7LlVqOI= github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= +github.com/multiformats/go-multiaddr v0.2.2 h1:XZLDTszBIJe6m0zF6ITBrEcZR73OPUhCBBS9rYAuUzI= +github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= @@ -367,12 +382,15 @@ github.com/multiformats/go-multiaddr-net v0.1.3 h1:q/IYAvoPKuRzGeERn3uacWgm0LIWk github.com/multiformats/go-multiaddr-net v0.1.3/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= github.com/multiformats/go-multiaddr-net v0.1.4 h1:g6gwydsfADqFvrHoMkS0n9Ok9CG6F7ytOH/bJDkhIOY= github.com/multiformats/go-multiaddr-net v0.1.4/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= +github.com/multiformats/go-multiaddr-net v0.1.5 h1:QoRKvu0xHN1FCFJcMQLbG/yQE2z441L5urvG3+qyz7g= +github.com/multiformats/go-multiaddr-net v0.1.5/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= +github.com/multiformats/go-multibase v0.0.2 h1:2pAgScmS1g9XjH7EtAfNhTuyrWYEWcxy0G5Wo85hWDA= +github.com/multiformats/go-multibase v0.0.2/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= @@ -382,19 +400,26 @@ github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -402,13 +427,40 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smola/gocompat v0.2.0 h1:6b1oIMlUXIpz//VKEDzPVBK8KG7beVwmHIUEBIs/Pns= -github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= +github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= +github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= +github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= +github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= +github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= +github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= +github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= +github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= +github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -417,18 +469,21 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho= +github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= +github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE= @@ -438,112 +493,176 @@ github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 h1:Y1/FEOpaCpD2 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo= +go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5 h1:Q7tZBpemrlsc2I7IyODzhtallWRSm4Q0d09pL6XbQtU= +golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190228165749-92fc7df08ae7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnfG5kSmgy9KZR9sW3W5QeA= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= -gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/introspect/default_inspector.go b/introspect/default_inspector.go new file mode 100644 index 0000000000..2389b0ea88 --- /dev/null +++ b/introspect/default_inspector.go @@ -0,0 +1,234 @@ +package introspect + +import ( + "fmt" + "math" + "runtime" + "sync" + "time" + + "github.com/libp2p/go-eventbus" + "github.com/libp2p/go-libp2p-core/event" + "github.com/libp2p/go-libp2p-core/host" + "github.com/libp2p/go-libp2p-core/introspection" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/metrics" + "github.com/libp2p/go-libp2p-core/network" +) + +var _ introspection.Introspector = (*DefaultIntrospector)(nil) + +// DefaultIntrospector is an object that introspects the system. +type DefaultIntrospector struct { + *eventManager + + host host.Host + bus event.Bus + wsub event.Subscription + reporter metrics.Reporter + started time.Time + + closeCh chan struct{} + closeWg sync.WaitGroup +} + +func NewDefaultIntrospector(host host.Host, reporter metrics.Reporter) (*DefaultIntrospector, error) { + bus := host.EventBus() + if bus == nil { + return nil, fmt.Errorf("introspector requires a host with eventbus capability") + } + + sub, err := bus.Subscribe(event.WildcardSubscription, eventbus.BufSize(256)) + if err != nil { + return nil, fmt.Errorf("failed to susbcribe for events with WildcardSubscription") + } + + d := &DefaultIntrospector{ + eventManager: newEventManager(sub.Out()), + host: host, + bus: bus, + wsub: sub, + reporter: reporter, + started: time.Now(), + closeCh: make(chan struct{}), + } + + d.closeWg.Add(1) + go d.processEvents() + return d, nil +} + +func (d *DefaultIntrospector) Close() error { + if err := d.wsub.Close(); err != nil { + return fmt.Errorf("failed while trying to close wildcard eventbus subscription: %w", err) + } + + close(d.closeCh) + d.closeWg.Wait() + + return nil +} + +func (d *DefaultIntrospector) FetchRuntime() (*pb.Runtime, error) { + return &pb.Runtime{ + Implementation: "go-libp2p", + Platform: runtime.GOOS, + PeerId: d.host.ID().Pretty(), + Version: "", + }, nil +} + +func (d *DefaultIntrospector) FetchFullState() (state *pb.State, err error) { + s := &pb.State{} + + // timestamps + s.StartTs = timeToUnixMillis(d.started) + s.InstantTs = timeToUnixMillis(time.Now()) + d.started = time.Now() + + // subsystems + s.Subsystems = &pb.Subsystems{} + s.Traffic, err = d.IntrospectGlobalTraffic() + if err != nil { + return nil, err + } + + conns := d.host.Network().Conns() + s.Subsystems.Connections = make([]*pb.Connection, 0, len(conns)) + for _, conn := range conns { + c, err := d.IntrospectConnection(conn) + if err != nil { + return nil, err + } + s.Subsystems.Connections = append(s.Subsystems.Connections, c) + } + + return s, nil +} + +// IntrospectGlobalTraffic introspects and returns total traffic stats for this swarm. +func (d *DefaultIntrospector) IntrospectGlobalTraffic() (*pb.Traffic, error) { + if d.reporter == nil { + return nil, nil + } + + metrics := d.reporter.GetBandwidthTotals() + t := &pb.Traffic{ + TrafficIn: &pb.DataGauge{ + CumBytes: uint64(metrics.TotalIn), + InstBw: uint64(metrics.RateIn), + }, + TrafficOut: &pb.DataGauge{ + CumBytes: uint64(metrics.TotalOut), + InstBw: uint64(metrics.RateOut), + }, + } + + return t, nil +} + +func (d *DefaultIntrospector) IntrospectConnection(conn network.Conn) (*pb.Connection, error) { + stat := conn.Stat() + openTs := uint64(stat.Opened.UnixNano() / 1000000) + + res := &pb.Connection{ + Id: []byte(conn.ID()), + Status: pb.Status_ACTIVE, + PeerId: conn.RemotePeer().Pretty(), + Endpoints: &pb.EndpointPair{ + SrcMultiaddr: conn.LocalMultiaddr().String(), + DstMultiaddr: conn.RemoteMultiaddr().String(), + }, + Role: translateRole(stat), + + Timeline: &pb.Connection_Timeline{ + OpenTs: openTs, + UpgradedTs: openTs, + // TODO ClosedTs, UpgradedTs. + }, + } + + // TODO this is a per-peer, not a per-conn measurement. In the future, when + // we have multiple connections per peer, this will produce inaccurate + // numbers. Also, we do not record stream-level stats. + // We don't have packet I/O stats. + if r := d.reporter; r != nil { + bw := r.GetBandwidthForPeer(conn.RemotePeer()) + res.Traffic = &pb.Traffic{ + TrafficIn: &pb.DataGauge{ + CumBytes: uint64(bw.TotalIn), + InstBw: uint64(math.Round(bw.RateIn)), + }, + TrafficOut: &pb.DataGauge{ + CumBytes: uint64(bw.TotalOut), + InstBw: uint64(math.Round(bw.RateOut)), + }, + } + } + + // TODO I don't think we pin the multiplexer and the secure channel we've + // negotiated anywhere. + res.Attribs = &pb.Connection_Attributes{} + + // TODO can we get the transport ID from the multiaddr? + res.TransportId = nil + + // TODO there's the ping protocol, but that's higher than this layer. + // How do we source this? We may need some kind of latency manager. + res.LatencyNs = 0 + + streams := conn.GetStreams() + res.Streams = &pb.StreamList{ + Streams: make([]*pb.Stream, 0, len(streams)), + } + + for _, stream := range streams { + s, err := d.IntrospectStream(stream) + if err != nil { + return nil, err + } + res.Streams.Streams = append(res.Streams.Streams, s) + } + + return res, nil +} + +func (d *DefaultIntrospector) IntrospectStream(stream network.Stream) (*pb.Stream, error) { + stat := stream.Stat() + openTs := uint64(stat.Opened.UnixNano() / 1000000) + + res := &pb.Stream{ + Id: []byte(stream.ID()), + Status: pb.Status_ACTIVE, + Conn: &pb.Stream_ConnectionRef{ + Connection: &pb.Stream_ConnectionRef_ConnId{ + ConnId: []byte(stream.Conn().ID()), + }, + }, + Protocol: string(stream.Protocol()), + Role: translateRole(stat), + Timeline: &pb.Stream_Timeline{ + OpenTs: openTs, + // TODO CloseTs. + }, + // TODO Traffic: we are not tracking per-stream traffic stats at the + Traffic: &pb.Traffic{TrafficIn: &pb.DataGauge{}, TrafficOut: &pb.DataGauge{}}, + // moment. + } + return res, nil +} + +func translateRole(stat network.Stat) pb.Role { + switch stat.Direction { + case network.DirInbound: + return pb.Role_RESPONDER + case network.DirOutbound: + return pb.Role_INITIATOR + default: + return 99 // TODO placeholder value + } +} + +func timeToUnixMillis(t time.Time) uint64 { + return uint64(t.UnixNano() / 1000000) +} \ No newline at end of file diff --git a/introspect/default_inspector_test.go b/introspect/default_inspector_test.go new file mode 100644 index 0000000000..15d7b14802 --- /dev/null +++ b/introspect/default_inspector_test.go @@ -0,0 +1,112 @@ +package introspect_test + +import ( + "context" + "testing" + "time" + + "github.com/libp2p/go-libp2p" + introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/metrics" + "github.com/libp2p/go-libp2p-core/network" + "github.com/libp2p/go-libp2p-core/peerstore" + "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p/introspect" + + "github.com/stretchr/testify/require" +) + +func TestConnsAndStreamIntrospect(t *testing.T) { + ctx := context.Background() + + bwc1 := metrics.NewBandwidthCounter() + h1, err := libp2p.New(ctx, libp2p.BandwidthReporter(bwc1)) + require.NoError(t, err) + + bwc2 := metrics.NewBandwidthCounter() + h2, err := libp2p.New(ctx, libp2p.BandwidthReporter(bwc2)) + require.NoError(t, err) + + introspector1, err := introspect.NewDefaultIntrospector(h1, bwc1) + require.NoError(t, err) + _, _ = introspect.NewDefaultIntrospector(h2, bwc2) + + h1.Peerstore().AddAddrs(h2.ID(), h2.Network().ListenAddresses(), peerstore.PermanentAddrTTL) + err = h1.Connect(ctx, h2.Peerstore().PeerInfo(h2.ID())) + require.NoError(t, err) + + // ----- H1 opens two streams to H2 + pid1, pid2 := protocol.ID("1"), protocol.ID("2") + h2.SetStreamHandler(pid1, func(stream network.Stream) {}) + h2.SetStreamHandler(pid2, func(stream network.Stream) {}) + + s1, err := h1.NewStream(ctx, h2.ID(), pid1) + require.NoError(t, err) + s2, err := h1.NewStream(ctx, h2.ID(), pid2) + require.NoError(t, err) + + // send 4 bytes on stream 1 & 5 bytes on stream 2 + msg1 := "abcd" + msg2 := "12345" + _, err = s1.Write([]byte(msg1)) + require.NoError(t, err) + _, err = s2.Write([]byte(msg2)) + require.NoError(t, err) + + // wait for the metrics to kick in + require.Eventually(t, func() bool { + state, _ := introspector1.FetchFullState() + return state.Traffic.TrafficOut.CumBytes != 0 + }, 3*time.Second, 100*time.Millisecond) + + // ----- Introspect host 1. + state, err := introspector1.FetchFullState() + require.NoError(t, err) + conns := state.Subsystems.Connections + + // connection asserts + require.Len(t, conns, 1) + require.NotEmpty(t, conns[0].Id) + require.Equal(t, h2.ID().String(), conns[0].PeerId) + require.Equal(t, introspection_pb.Status_ACTIVE, conns[0].Status) + require.Equal(t, introspection_pb.Role_INITIATOR, conns[0].Role) + require.Equal(t, h1.Network().Conns()[0].LocalMultiaddr().String(), conns[0].Endpoints.SrcMultiaddr) + require.Equal(t, h1.Network().Conns()[0].RemoteMultiaddr().String(), conns[0].Endpoints.DstMultiaddr) + + // stream asserts. + streams := conns[0].Streams.Streams + require.Len(t, streams, 2) + require.NoError(t, err) + + // map stream to protocols + protos := make(map[string]*introspection_pb.Stream) + for _, s := range streams { + protos[s.Protocol] = s + } + + // introspect stream 1 + stream1 := protos["1"] + require.NotEmpty(t, stream1) + require.Equal(t, "1", stream1.Protocol) + require.Equal(t, introspection_pb.Role_INITIATOR, stream1.Role) + require.Equal(t, introspection_pb.Status_ACTIVE, stream1.Status) + require.NotEmpty(t, stream1.Id) + require.NotNil(t, stream1.Traffic) + require.NotNil(t, stream1.Traffic.TrafficIn) + require.NotNil(t, stream1.Traffic.TrafficOut) + + // introspect stream 2 + stream2 := protos["2"] + require.NotEmpty(t, stream2) + require.Equal(t, "2", stream2.Protocol) + require.Equal(t, introspection_pb.Role_INITIATOR, stream2.Role) + require.Equal(t, introspection_pb.Status_ACTIVE, stream2.Status) + require.NotEmpty(t, stream2.Id) + require.NotEqual(t, stream2.Id, stream1.Id) + + // introspect traffic + tr := state.Traffic + require.NoError(t, err) + require.NotZero(t, tr.TrafficOut.CumBytes) + require.Zero(t, tr.TrafficIn.CumBytes == 0) +} diff --git a/introspect/event_manager.go b/introspect/event_manager.go new file mode 100644 index 0000000000..3318c38691 --- /dev/null +++ b/introspect/event_manager.go @@ -0,0 +1,194 @@ +package introspect + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "sync" + "time" + + "github.com/ipfs/go-log/v2" + + "github.com/libp2p/go-libp2p-core/event" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/peer" + + "github.com/multiformats/go-multiaddr" +) + +var ( + jsType = reflect.TypeOf(new(event.RawJSON)).Elem() + peerIdType = reflect.TypeOf(new(peer.ID)).Elem() + timeType = reflect.TypeOf(new(time.Time)).Elem() + maddrType = reflect.TypeOf(new(multiaddr.Multiaddr)).Elem() +) + +type eventManager struct { + sync.RWMutex + logger *log.ZapEventLogger + + inCh <-chan interface{} + outCh chan *pb.Event + metadata map[reflect.Type]*pb.EventType + + closed bool + closeCh chan struct{} + closeWg sync.WaitGroup +} + +func newEventManager(inCh <-chan interface{}) *eventManager { + em := &eventManager{ + inCh: inCh, + logger: log.Logger("introspection/event-manager"), + outCh: make(chan *pb.Event, cap(inCh)), + closeCh: make(chan struct{}), + metadata: make(map[reflect.Type]*pb.EventType), + } + + em.closeWg.Add(1) + go em.processEvents() + return em +} + +func (em *eventManager) Close() error { + em.Lock() + defer em.Unlock() + + if em.closed { + em.closeWg.Wait() + return nil + } + + close(em.closeCh) + em.closeWg.Wait() + return nil +} + +func (em *eventManager) EventChan() <-chan *pb.Event { + return em.outCh +} + +func (em *eventManager) EventMetadata() []*pb.EventType { + em.RLock() + defer em.RUnlock() + + res := make([]*pb.EventType, 0, len(em.metadata)) + for k := range em.metadata { + v := em.metadata[k] + res = append(res, v) + } + return res +} + +func (em *eventManager) processEvents() { + defer em.closeWg.Done() + defer close(em.outCh) + + for { + select { + case <-em.closeCh: + return + + case evt, more := <-em.inCh: + if !more { + return + } + + e, err := em.createEvent(evt) + if err != nil { + em.logger.Warnf("failed to process event; err: %s", err) + continue + } + + select { + case em.outCh <- e: + case <-em.closeCh: + return + default: + em.logger.Warnf("failed to queue event") + } + } + } +} + +func (em *eventManager) createEvent(evt interface{}) (*pb.Event, error) { + js, err := json.Marshal(evt) + if err != nil { + return nil, fmt.Errorf("failed to marshal event to json; err: %w", err) + } + + ret := &pb.Event{ + Type: &pb.EventType{}, + Ts: uint64(time.Now().UnixNano() / int64(time.Millisecond)), + Content: string(js), + } + + key := reflect.TypeOf(evt) + + em.RLock() + et, ok := em.metadata[key] + em.RUnlock() + + if ok { + // just send the name if we've already seen the event before + ret.Type.Name = et.Name + return ret, nil + } + + if key.Kind() != reflect.Struct { + return nil, errors.New("event type must be a struct") + } + + ret.Type.Name = key.Name() + ret.Type.PropertyTypes = make([]*pb.EventType_EventProperty, 0, key.NumField()) + + for i := 0; i < key.NumField(); i++ { + fld := key.Field(i) + fldType := fld.Type + + prop := &pb.EventType_EventProperty{} + prop.Name = fld.Name + + if fldType.Kind() == reflect.Array || fldType.Kind() == reflect.Slice { + prop.HasMultiple = true + fldType = fld.Type.Elem() + } + + switch fldType { + case jsType: + prop.Type = pb.EventType_EventProperty_JSON + case peerIdType: + prop.Type = pb.EventType_EventProperty_PEERID + case maddrType: + prop.Type = pb.EventType_EventProperty_MULTIADDR + case timeType: + prop.Type = pb.EventType_EventProperty_TIME + default: + switch fldType.Kind() { + case reflect.String: + prop.Type = pb.EventType_EventProperty_STRING + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, + reflect.Uint64, reflect.Float32, reflect.Float64: + prop.Type = pb.EventType_EventProperty_NUMBER + default: + prop.Type = pb.EventType_EventProperty_JSON + } + } + + ret.Type.PropertyTypes = append(ret.Type.PropertyTypes, prop) + } + + em.Lock() + et, ok = em.metadata[key] + if ok { + // another write added the entry in the interim; discard ours. + em.Unlock() + ret.Type = et + return ret, nil + } + em.metadata[key] = ret.Type + em.Unlock() + return ret, nil +} diff --git a/introspect/event_manager_test.go b/introspect/event_manager_test.go new file mode 100644 index 0000000000..3878cb35bc --- /dev/null +++ b/introspect/event_manager_test.go @@ -0,0 +1,149 @@ +package introspect + +import ( + "testing" + "time" + + "github.com/multiformats/go-multiaddr" + "github.com/stretchr/testify/require" + + "github.com/libp2p/go-libp2p-core/event" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/peer" +) + +type omnievent struct { + String string + Strings []string + Int int + Ints []int + RawJSON event.RawJSON + RawJSONs []event.RawJSON + PeerID peer.ID + PeerIDs []peer.ID + Time time.Time + Times []time.Time + Multiaddr multiaddr.Multiaddr + Multiaddrs []multiaddr.Multiaddr + Nested struct { + String string + Strings []string + Int int + Ints []int + RawJSON event.RawJSON + RawJSONs []event.RawJSON + PeerID peer.ID + PeerIDs []peer.ID + Time time.Time + Times []time.Time + Multiaddr multiaddr.Multiaddr + Multiaddrs []multiaddr.Multiaddr + } +} + +type EventA omnievent +type EventB omnievent + +func TestEventManager(t *testing.T) { + inCh := make(chan interface{}, 10) + em := newEventManager(inCh) + defer em.Close() + + require.Empty(t, em.EventMetadata()) + inCh <- EventA{} + + evt := <-em.EventChan() + require.NotNil(t, evt) + + compare := []struct { + Name string + Type pb.EventType_EventProperty_PropertyType + Multiple bool + }{ + {"String", pb.EventType_EventProperty_STRING, false}, + {"Strings", pb.EventType_EventProperty_STRING, true}, + {"Int", pb.EventType_EventProperty_NUMBER, false}, + {"Ints", pb.EventType_EventProperty_NUMBER, true}, + {"RawJSON", pb.EventType_EventProperty_JSON, false}, + {"RawJSONs", pb.EventType_EventProperty_JSON, true}, + {"PeerID", pb.EventType_EventProperty_PEERID, false}, + {"PeerIDs", pb.EventType_EventProperty_PEERID, true}, + {"Time", pb.EventType_EventProperty_TIME, false}, + {"Times", pb.EventType_EventProperty_TIME, true}, + {"Multiaddr", pb.EventType_EventProperty_MULTIADDR, false}, + {"Multiaddrs", pb.EventType_EventProperty_MULTIADDR, true}, + {"Nested", pb.EventType_EventProperty_JSON, false}, + } + + require.Equal(t, "EventA", evt.Type.Name) + + for i, pt := range evt.Type.PropertyTypes { + require.Equal(t, compare[i].Name, pt.Name) + require.Equal(t, compare[i].Type, pt.Type) + require.Equal(t, compare[i].Multiple, pt.HasMultiple) + } + + require.Len(t, em.EventMetadata(), 1) + require.Equal(t, evt.Type, em.EventMetadata()[0]) + + // send another event of type EventA; it should not inline the type definition. + inCh <- EventA{} + + evt = <-em.EventChan() + require.NotNil(t, evt) + require.Equal(t, "EventA", evt.Type.Name) + require.Nil(t, evt.Type.PropertyTypes) + + // send a new event; the type definition must be inlined. + inCh <- EventB{} + + evt = <-em.EventChan() + require.NotNil(t, evt) + require.Equal(t, "EventB", evt.Type.Name) + + for i, pt := range evt.Type.PropertyTypes { + require.Equal(t, compare[i].Name, pt.Name) + require.Equal(t, compare[i].Type, pt.Type) + require.Equal(t, compare[i].Multiple, pt.HasMultiple) + } + + require.Len(t, em.EventMetadata(), 2) +} + +func TestSubscriptionClosedClosesOut(t *testing.T) { + inCh := make(chan interface{}, 10) + em := newEventManager(inCh) + defer em.Close() + + require.Empty(t, em.EventMetadata()) + inCh <- EventA{} + + evt := <-em.EventChan() + require.NotNil(t, evt) + close(inCh) + + evt, more := <-em.EventChan() + require.Nil(t, evt) + require.False(t, more) +} + +func TestCloseStopsProcessing(t *testing.T) { + inCh := make(chan interface{}, 10) + em := newEventManager(inCh) + + require.Empty(t, em.EventMetadata()) + inCh <- EventA{} + evt := <-em.EventChan() + require.NotNil(t, evt) + + err := em.Close() + require.NoError(t, err) + + inCh <- EventA{} + inCh <- EventA{} + require.Len(t, inCh, 2) + + evt, more := <-em.EventChan() + require.Nil(t, evt) + require.False(t, more) +} diff --git a/introspect/mock_inspector.go b/introspect/mock_inspector.go new file mode 100644 index 0000000000..ab84bbfbdf --- /dev/null +++ b/introspect/mock_inspector.go @@ -0,0 +1,39 @@ +package introspect + +import ( + "github.com/stretchr/testify/mock" + + "github.com/libp2p/go-libp2p-core/introspection" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" +) + +type MockIntrospector struct { + *eventManager + mock.Mock + + EventCh chan interface{} +} + +var _ introspection.Introspector = (*MockIntrospector)(nil) + +func NewMockIntrospector() *MockIntrospector { + mi := &MockIntrospector{ + EventCh: make(chan interface{}, 128), + } + mi.eventManager = newEventManager(mi.EventCh) + return mi +} + +func (m *MockIntrospector) Close() error { + return m.eventManager.Close() +} + +func (m *MockIntrospector) FetchRuntime() (*pb.Runtime, error) { + args := m.MethodCalled("FetchRuntime") + return args.Get(0).(*pb.Runtime), args.Error(1) +} + +func (m *MockIntrospector) FetchFullState() (*pb.State, error) { + args := m.MethodCalled("FetchFullState") + return args.Get(0).(*pb.State), args.Error(1) +} diff --git a/introspect/ws/server.go b/introspect/ws/server.go new file mode 100644 index 0000000000..1cdc481022 --- /dev/null +++ b/introspect/ws/server.go @@ -0,0 +1,346 @@ +package ws + +import ( + "encoding/binary" + "errors" + "fmt" + "hash/fnv" + "net" + "net/http" + "sync" + + "github.com/libp2p/go-libp2p-core/introspection" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" + + "github.com/benbjohnson/clock" + "github.com/gorilla/websocket" + logging "github.com/ipfs/go-log" +) + +var ( + logger = logging.Logger("introspection/ws-server") + upgrader = websocket.Upgrader{} +) + +type sessionEvent struct { + session *session + doneCh chan struct{} +} + +type Server struct { + // state initialized by constructor + introspector introspection.Introspector + config *ServerConfig + server *http.Server + clock clock.Clock + + sessions map[*session]struct{} + + // state managed in the event loop + sessionOpenedCh chan *sessionEvent + sessionClosedCh chan *sessionEvent + getSessionsCh chan chan []*introspection.Session + killSessionsCh chan struct{} + + evalForTest chan func() + + // state managed by locking + lk sync.RWMutex + listeners []net.Listener + + connsWg sync.WaitGroup + controlWg sync.WaitGroup + + closeCh chan struct{} + isClosed bool +} + +var _ introspection.Endpoint = (*Server)(nil) + +type ServerConfig struct { + ListenAddrs []string + Clock clock.Clock +} + +// ServerWithConfig returns a function compatible with the +// libp2p.Introspection constructor option, which when called, creates a +// Server with the supplied configuration. +func ServerWithConfig(config *ServerConfig) func(i introspection.Introspector) (introspection.Endpoint, error) { + return func(i introspection.Introspector) (introspection.Endpoint, error) { + return NewServer(i, config) + } +} + +// NewServer creates a WebSockets server to serve introspect data. +func NewServer(introspector introspection.Introspector, config *ServerConfig) (*Server, error) { + if introspector == nil || config == nil { + return nil, errors.New("none of introspect, event-bus OR config can be nil") + } + + mux := http.NewServeMux() + + srv := &Server{ + introspector: introspector, + server: &http.Server{Handler: mux}, + config: config, + clock: config.Clock, + + sessions: make(map[*session]struct{}, 16), + evalForTest: make(chan func()), + + sessionOpenedCh: make(chan *sessionEvent), + sessionClosedCh: make(chan *sessionEvent), + killSessionsCh: make(chan struct{}), + getSessionsCh: make(chan chan []*introspection.Session), + + closeCh: make(chan struct{}), + } + + if srv.clock == nil { + // use the real clock. + srv.clock = clock.New() + } + + // register introspect session + mux.HandleFunc("/introspect", srv.wsUpgrader()) + return srv, nil +} + +// Start starts this WS server. +func (s *Server) Start() error { + s.lk.Lock() + defer s.lk.Unlock() + + if len(s.listeners) > 0 { + return errors.New("failed to start WS server: already started") + } + if len(s.config.ListenAddrs) == 0 { + return errors.New("failed to start WS server: no listen addresses supplied") + } + + logger.Infof("WS introspection server starting, listening on %s", s.config.ListenAddrs) + + for _, addr := range s.config.ListenAddrs { + l, err := net.Listen("tcp", addr) + if err != nil { + return fmt.Errorf("failed to start WS server: %wsvc", err) + } + + go func() { + if err := s.server.Serve(l); err != http.ErrServerClosed { + logger.Errorf("failed to start WS server, err: %s", err) + } + }() + + s.listeners = append(s.listeners, l) + } + + // start the worker + s.controlWg.Add(1) + go s.worker() + + return nil +} + +// Close closes a WS introspect server. +func (s *Server) Close() error { + s.lk.Lock() + defer s.lk.Unlock() + + if s.isClosed { + return nil + } + + close(s.killSessionsCh) + + // wait for all connections to be dead. + s.connsWg.Wait() + + close(s.closeCh) + + // Close the server, which in turn closes all listeners. + if err := s.server.Close(); err != nil { + return err + } + + // cancel the context and wait for all goroutines to shut down + s.controlWg.Wait() + + s.listeners = nil + s.sessions = nil + s.isClosed = true + return nil +} + +// ListenAddrs returns the actual listen addresses of this server. +func (s *Server) ListenAddrs() []string { + s.lk.RLock() + defer s.lk.RUnlock() + + res := make([]string, 0, len(s.listeners)) + for _, l := range s.listeners { + res = append(res, l.Addr().String()) + } + return res +} + +func (s *Server) Sessions() []*introspection.Session { + ch := make(chan []*introspection.Session) + s.getSessionsCh <- ch + return <-ch +} + +func (s *Server) wsUpgrader() http.HandlerFunc { + return func(w http.ResponseWriter, rq *http.Request) { + upgrader.CheckOrigin = func(rq *http.Request) bool { return true } + wsconn, err := upgrader.Upgrade(w, rq, nil) + if err != nil { + logger.Errorf("upgrade to websocket failed, err: %s", err) + return + } + + done := make(chan struct{}, 1) + select { + case s.sessionOpenedCh <- &sessionEvent{newSession(s, wsconn), done}: + case <-s.closeCh: + _ = wsconn.Close() + return + } + + select { + case <-done: + case <-s.closeCh: + _ = wsconn.Close() + return + } + } +} + +func (s *Server) worker() { + defer s.controlWg.Done() + + eventCh := s.introspector.EventChan() + for { + select { + case rq := <-s.sessionOpenedCh: + session := rq.session + s.sessions[session] = struct{}{} + + s.connsWg.Add(1) + go func() { + session.run() + + select { + case s.sessionClosedCh <- &sessionEvent{session, rq.doneCh}: + case <-s.closeCh: + return + } + }() + + case rq := <-s.sessionClosedCh: + delete(s.sessions, rq.session) + s.connsWg.Done() + + case evt, more := <-eventCh: + if !more { + eventCh = nil + continue + } + + if len(s.sessions) == 0 { + continue + } + + // generate the event and broadcast it to all sessions. + if err := s.broadcastEvent(evt); err != nil { + logger.Warnf("error while broadcasting event; err: %s", err) + } + + case fnc := <-s.evalForTest: + fnc() + + case ch := <-s.getSessionsCh: + sessions := make([]*introspection.Session, 0, len(s.sessions)) + for sess := range s.sessions { + sessions = append(sessions, &introspection.Session{RemoteAddr: sess.wsconn.RemoteAddr().String()}) + } + ch <- sessions + + case <-s.killSessionsCh: + for sess := range s.sessions { + sess.kill() + } + + case <-s.closeCh: + return + } + } +} + +func (s *Server) broadcastEvent(evt *pb.Event) error { + pkt := &pb.ServerMessage{ + Version: introspection.ProtoVersionPb, + Payload: &pb.ServerMessage_Event{Event: evt}, + } + + msg, err := envelopePacket(pkt) + if err != nil { + return fmt.Errorf("failed to generate enveloped event message; err: %w", err) + } + + for sess := range s.sessions { + sess.trySendEvent(msg) + } + + return nil +} + +func (s *Server) createStateMsg() ([]byte, error) { + st, err := s.introspector.FetchFullState() + if err != nil { + return nil, fmt.Errorf("failed to fetch state, err=%s", err) + } + + pkt := &pb.ServerMessage{ + Version: introspection.ProtoVersionPb, + Payload: &pb.ServerMessage_State{State: st}, + } + + return envelopePacket(pkt) +} + +func (s *Server) createRuntimeMsg() ([]byte, error) { + rt, err := s.introspector.FetchRuntime() + if err != nil { + return nil, fmt.Errorf("failed to fetch runtime mesage, err=%s", err) + } + + rt.EventTypes = s.introspector.EventMetadata() + pkt := &pb.ServerMessage{ + Version: introspection.ProtoVersionPb, + Payload: &pb.ServerMessage_Runtime{Runtime: rt}, + } + + return envelopePacket(pkt) +} + +func envelopePacket(pkt *pb.ServerMessage) ([]byte, error) { + // TODO buffer pool. + size := pkt.Size() + buf := make([]byte, 12+size) + if _, err := pkt.MarshalToSizedBuffer(buf[12:]); err != nil { + return nil, err + } + + f := fnv.New32a() + _, err := f.Write(buf[12:]) + if err != nil { + return nil, fmt.Errorf("failed creating fnc hash digest, err: %w", err) + } + + binary.LittleEndian.PutUint32(buf[0:4], introspection.ProtoVersion) + binary.LittleEndian.PutUint32(buf[4:8], f.Sum32()) + binary.LittleEndian.PutUint32(buf[8:12], uint32(size)) + + return buf, nil +} diff --git a/introspect/ws/server_common_test.go b/introspect/ws/server_common_test.go new file mode 100644 index 0000000000..e9bdb96f2d --- /dev/null +++ b/introspect/ws/server_common_test.go @@ -0,0 +1,95 @@ +package ws + +import ( + "encoding/binary" + "fmt" + "hash/fnv" + "testing" + + "github.com/benbjohnson/clock" + "github.com/gorilla/websocket" + "github.com/stretchr/testify/require" + + "github.com/libp2p/go-libp2p-core/introspection" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p/introspect" +) + +func createTestServer(t *testing.T) (*Server, *introspect.MockIntrospector) { + t.Helper() + + mocki := introspect.NewMockIntrospector() + cfg := &ServerConfig{ListenAddrs: []string{"localhost:0"}, Clock: clock.NewMock()} + server, err := NewServer(mocki, cfg) + require.NoError(t, err) + return server, mocki +} + +type connWrapper struct { + *websocket.Conn + t *testing.T +} + +func createConn(t *testing.T, server *Server) *connWrapper { + addr := fmt.Sprintf("ws://%s/introspect", server.ListenAddrs()[0]) + conn, _, err := websocket.DefaultDialer.Dial(addr, nil) + require.NoError(t, err) + return &connWrapper{conn, t} +} + +func (cw *connWrapper) sendCommand(cmd *pb.ClientCommand) { + cw.t.Helper() + + msg, err := cmd.Marshal() + require.NoError(cw.t, err) + + err = cw.WriteMessage(websocket.BinaryMessage, msg) + require.NoError(cw.t, err) +} + +func (cw *connWrapper) greet() { + cw.t.Helper() + + cw.sendCommand(&pb.ClientCommand{Id: 200, Command: pb.ClientCommand_HELLO}) + + msg := cw.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(cw.t, 200, resp.Id) + require.EqualValues(cw.t, pb.CommandResponse_OK, resp.Result) + require.Empty(cw.t, resp.Error) +} + +func (cw *connWrapper) readNext() *pb.ServerMessage { + cw.t.Helper() + + _, msg, err := cw.ReadMessage() + require.NoError(cw.t, err) + + var ( + // parse the message + version = msg[0:4] + checksum = msg[4:8] + length = msg[8:12] + payload = msg[12:] + ) + + require.EqualValues(cw.t, introspection.ProtoVersion, binary.LittleEndian.Uint32(version)) + require.EqualValues(cw.t, len(payload), binary.LittleEndian.Uint32(length)) + + // validate hash. + h := fnv.New32a() + _, err = h.Write(payload) + require.NoError(cw.t, err) + require.EqualValues(cw.t, h.Sum32(), binary.LittleEndian.Uint32(checksum)) + + smsg := &pb.ServerMessage{} + + // read the protocol message directly + require.NoError(cw.t, smsg.Unmarshal(payload)) + + require.NotNil(cw.t, smsg.Payload, "nil message received from server") + require.Equal(cw.t, introspection.ProtoVersion, smsg.Version.Version, "incorrect proto version receieved from client") + + return smsg +} diff --git a/introspect/ws/server_config_test.go b/introspect/ws/server_config_test.go new file mode 100644 index 0000000000..a4a72f8b81 --- /dev/null +++ b/introspect/ws/server_config_test.go @@ -0,0 +1,90 @@ +package ws + +import ( + "testing" + + "github.com/stretchr/testify/require" + + pb "github.com/libp2p/go-libp2p-core/introspection/pb" +) + +func TestValidConfiguration(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + config := &pb.Configuration{ + RetentionPeriodMs: uint64(MaxRetentionPeriod.Milliseconds() - 1), + StateSnapshotIntervalMs: uint64(MinStateSnapshotInterval.Milliseconds() + 1), + } + + // on HELLO + conn.sendCommand(&pb.ClientCommand{Id: 200, Command: pb.ClientCommand_HELLO, Config: config}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 200, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + require.EqualValues(t, config, resp.EffectiveConfig) + require.Empty(t, resp.Error) + + // on UPDATE_VALUES, adjust the values to verify new values have been set. + config.RetentionPeriodMs -= 1 + config.StateSnapshotIntervalMs += 1 + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_UPDATE_CONFIG, Config: config}) + + msg = conn.readNext() + resp = msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + require.EqualValues(t, config, resp.EffectiveConfig) + require.Empty(t, resp.Error) +} + +func TestHelloWithInvalidConfig(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + expected := &pb.Configuration{ + RetentionPeriodMs: uint64(MaxRetentionPeriod.Milliseconds()), + StateSnapshotIntervalMs: uint64(MinStateSnapshotInterval.Milliseconds()), + } + + config := &pb.Configuration{ + RetentionPeriodMs: uint64(MaxRetentionPeriod.Milliseconds() + 1), + StateSnapshotIntervalMs: uint64(MinStateSnapshotInterval.Milliseconds() - 1), + } + + // on HELLO + conn.sendCommand(&pb.ClientCommand{Id: 200, Command: pb.ClientCommand_HELLO, Config: config}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 200, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + require.EqualValues(t, expected, resp.EffectiveConfig) + require.Empty(t, resp.Error) + + // on UPDATE_VALUES, adjust the values to verify new values have been set. + config.RetentionPeriodMs += 1 + config.StateSnapshotIntervalMs -= 1 + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_UPDATE_CONFIG, Config: config}) + + msg = conn.readNext() + resp = msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + require.EqualValues(t, expected, resp.EffectiveConfig) + require.Empty(t, resp.Error) +} \ No newline at end of file diff --git a/introspect/ws/server_hello_test.go b/introspect/ws/server_hello_test.go new file mode 100644 index 0000000000..e1eff9f5a3 --- /dev/null +++ b/introspect/ws/server_hello_test.go @@ -0,0 +1,56 @@ +package ws + +import ( + "testing" + + "github.com/stretchr/testify/require" + + pb "github.com/libp2p/go-libp2p-core/introspection/pb" +) + +func TestStartSession(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() +} + +func TestDoubleHelloFails(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_HELLO}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_ERR, resp.Result) +} + +func TestNoHelloFails(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.sendCommand(&pb.ClientCommand{Id: 200, Command: pb.ClientCommand_REQUEST, Source: pb.ClientCommand_RUNTIME}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 200, resp.Id) + require.EqualValues(t, pb.CommandResponse_ERR, resp.Result) +} \ No newline at end of file diff --git a/introspect/ws/server_lifecycle_test.go b/introspect/ws/server_lifecycle_test.go new file mode 100644 index 0000000000..fa82c89a8c --- /dev/null +++ b/introspect/ws/server_lifecycle_test.go @@ -0,0 +1,53 @@ +package ws + +import ( + "io" + "strings" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestServerClose(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + + // create 100 connections. + var wg sync.WaitGroup + conns := make([]*connWrapper, 100) + wg.Add(100) + for i := range conns { + conn := createConn(t, server) + go func() { + _, _, err := conn.ReadMessage() + if strings.Contains(err.Error(), io.ErrUnexpectedEOF.Error()) { + wg.Done() + } + }() + conns[i] = conn + } + + err := server.Close() + require.NoError(t, err) + wg.Wait() +} + +func TestServerHandlesClosedConns(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + + conns := make([]*connWrapper, 100) + for i := range conns { + conn := createConn(t, server) + conns[i] = conn + } + + require.Len(t, server.Sessions(), 100) + + err := conns[0].Close() + require.NoError(t, err) + + require.Eventually(t, func() bool { return len(server.Sessions()) == 99 }, 2 * time.Second, 100 * time.Millisecond) +} diff --git a/introspect/ws/server_push_test.go b/introspect/ws/server_push_test.go new file mode 100644 index 0000000000..057451d155 --- /dev/null +++ b/introspect/ws/server_push_test.go @@ -0,0 +1,137 @@ +package ws + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + pb "github.com/libp2p/go-libp2p-core/introspection/pb" +) + +type simpleEvent struct { + String string + Number int +} + +type EventA simpleEvent +type EventB simpleEvent +type EventC simpleEvent + +func TestPushEvents(t *testing.T) { + server, mocki := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + + assertEvent := func(name string) { + msg := conn.readNext() + evt := msg.Payload.(*pb.ServerMessage_Event).Event + + require.EqualValues(t, name, evt.Type.Name) + require.NotEmpty(t, evt.Content) + require.NotZero(t, evt.Ts) + } + + mocki.EventCh<-EventA{String: "hello", Number: 100} + mocki.EventCh<-EventA{String: "hello", Number: 100} + mocki.EventCh<-EventB{String: "hello", Number: 100} + + assertEvent("EventA") + assertEvent("EventA") + assertEvent("EventB") +} + +func TestPushStopPushEvents(t *testing.T) { + server, mocki := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + + assertEvent := func(name string) { + msg := conn.readNext() + evt := msg.Payload.(*pb.ServerMessage_Event).Event + + require.EqualValues(t, name, evt.Type.Name) + require.NotEmpty(t, evt.Content) + require.NotZero(t, evt.Ts) + } + + mocki.EventCh<-EventA{String: "hello", Number: 100} + assertEvent("EventA") + + // now disable the pusher and verify that we actually missed those events. + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_DISABLE, Source: pb.ClientCommand_EVENTS}) + msg = conn.readNext() + resp = msg.Payload.(*pb.ServerMessage_Response).Response + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + + time.Sleep(1 * time.Second) + + // these events will be missed. + mocki.EventCh<-EventA{String: "hello", Number: 100} + mocki.EventCh<-EventB{String: "hello", Number: 100} + + // enable the pusher again + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + msg = conn.readNext() + resp = msg.Payload.(*pb.ServerMessage_Response).Response + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + + // these events will be received. + mocki.EventCh<-EventC{String: "hello", Number: 100} + mocki.EventCh<-EventC{String: "hello", Number: 100} + + assertEvent("EventC") + assertEvent("EventC") +} + +func TestPushEventsIdempotent(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) + + conn.sendCommand(&pb.ClientCommand{Id: 202, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + + msg = conn.readNext() + resp = msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 202, resp.Id) + require.EqualValues(t, pb.CommandResponse_OK, resp.Result) +} diff --git a/introspect/ws/server_request_test.go b/introspect/ws/server_request_test.go new file mode 100644 index 0000000000..03a6f46a0c --- /dev/null +++ b/introspect/ws/server_request_test.go @@ -0,0 +1,64 @@ +package ws + +import ( + "testing" + + "github.com/stretchr/testify/require" + + pb "github.com/libp2p/go-libp2p-core/introspection/pb" +) + +func TestRequestState(t *testing.T) { + server, mocki := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + + mocki.On("FetchFullState").Return(&pb.State{}, nil) + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_REQUEST, Source: pb.ClientCommand_STATE}) + + msg := conn.readNext() + require.NotNil(t, msg.Payload.(*pb.ServerMessage_State).State) + mocki.AssertNumberOfCalls(t, "FetchFullState", 1) +} + +func TestRequestRuntime(t *testing.T) { + server, mocki := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + + mocki.On("FetchRuntime").Return(&pb.Runtime{}, nil) + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_REQUEST, Source: pb.ClientCommand_RUNTIME}) + + msg := conn.readNext() + require.NotNil(t, msg.Payload.(*pb.ServerMessage_Runtime).Runtime) + mocki.AssertNumberOfCalls(t, "FetchRuntime", 1) +} + +func TestRequestEventsFails(t *testing.T) { + server, _ := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_REQUEST, Source: pb.ClientCommand_EVENTS}) + + msg := conn.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.EqualValues(t, 201, resp.Id) + require.EqualValues(t, pb.CommandResponse_ERR, resp.Result) +} \ No newline at end of file diff --git a/introspect/ws/session.go b/introspect/ws/session.go new file mode 100644 index 0000000000..1fe8e0277c --- /dev/null +++ b/introspect/ws/session.go @@ -0,0 +1,422 @@ +package ws + +import ( + "fmt" + "sync" + "sync/atomic" + "time" + + "github.com/libp2p/go-libp2p-core/introspection" + pb "github.com/libp2p/go-libp2p-core/introspection/pb" + + "github.com/benbjohnson/clock" + "github.com/gorilla/websocket" + "go.uber.org/zap" +) + +var handlers = map[pb.ClientCommand_Command]func(*session, *pb.ClientCommand) *pb.ServerMessage{ + pb.ClientCommand_HELLO: (*session).handleHelloCmd, + pb.ClientCommand_REQUEST: (*session).handleRequestCmd, + pb.ClientCommand_PUSH_ENABLE: (*session).handlePushEnableCmd, + pb.ClientCommand_PUSH_DISABLE: (*session).handlePushDisableCmd, + pb.ClientCommand_PUSH_PAUSE: (*session).handlePushPauseCmd, + pb.ClientCommand_PUSH_RESUME: (*session).handlePushResumeCmd, + pb.ClientCommand_UPDATE_CONFIG: (*session).handleUpdateConfigCmd, +} + +var ( + MaxRetentionPeriod = 120 * time.Second + MinStateSnapshotInterval = 500 * time.Millisecond + + WriteTimeout = 5 * time.Second + ConnBufferSize = 1 << 8 + + DefaultSessionConfig = &pb.Configuration{ + RetentionPeriodMs: uint64(120 * time.Second / time.Millisecond), + StateSnapshotIntervalMs: uint64(time.Second / time.Millisecond), + } +) + +type session struct { + server *Server + wsconn *websocket.Conn + logger *zap.SugaredLogger + writeCh chan []byte + + pushingEvents bool + pushingState bool + paused bool + + eventCh chan []byte + commandCh chan *pb.ClientCommand + + stateTicker *clock.Ticker + + greeted bool + config *pb.Configuration + q []struct { + ts time.Time + payload []byte + } + + wg sync.WaitGroup + closed int32 + closeCh chan struct{} +} + +func newSession(sv *Server, wsconn *websocket.Conn) *session { + ch := &session{ + server: sv, + wsconn: wsconn, + config: DefaultSessionConfig, + stateTicker: new(clock.Ticker), + + writeCh: make(chan []byte, ConnBufferSize), + eventCh: make(chan []byte, ConnBufferSize), + commandCh: make(chan *pb.ClientCommand), + closeCh: make(chan struct{}), + } + + ch.logger = logger.Named(wsconn.RemoteAddr().String()) + return ch +} + +func (s *session) run() { + s.wg.Add(3) + + go s.writeLoop() + go s.readLoop() + go s.control() + + s.wg.Wait() +} + +func (s *session) trySendEvent(msg []byte) { + select { + case s.eventCh <- msg: + case <-s.closeCh: + default: + s.logger.Warnf("unable to queue event; dropping") + } +} + +func (s *session) queueWrite(msg []byte) { + select { + case s.writeCh <- msg: + case <-s.closeCh: + s.logger.Warnf("dropping queued message upon close") + } +} + +func (s *session) control() { + defer s.wg.Done() + + // dummy ticker that won't tick unless enabled. + pruneQTicker := time.NewTicker(2 * time.Second) + defer pruneQTicker.Stop() + defer func() { + if s.pushingState { + s.stateTicker.Stop() + } + }() + + for { + select { + case <-s.stateTicker.C: + msg, err := s.server.createStateMsg() + if err != nil { + s.logger.Warnf("failed to generate state message on tick; err: %s", err) + continue + } + s.queueWrite(msg) + + case now := <-pruneQTicker.C: + if !s.paused || len(s.q) == 0 { + continue + } + + i := 0 + thres := now.Add(-time.Duration(s.config.RetentionPeriodMs) * time.Millisecond) + for ; i < len(s.q) && s.q[i].ts.Before(thres); i++ { + } + s.q = s.q[i:] + + case evt := <-s.eventCh: + if !s.pushingEvents { + continue + } + if s.paused { + s.q = append(s.q, struct { + ts time.Time + payload []byte + }{time.Now(), evt}) + continue + } + s.queueWrite(evt) + + case cmd := <-s.commandCh: + var resp *pb.ServerMessage + handler, ok := handlers[cmd.Command] + if !ok { + err := fmt.Errorf("unknown command type: %v", cmd.Command) + resp = createCmdErrorResp(cmd, err) + s.logger.Warnf("%s", err) + } else { + resp = handler(s, cmd) + } + + if resp != nil { + msg, err := envelopePacket(resp) + if err != nil { + s.logger.Warnf("failed to marshal client message; err: %s", err) + s.kill() + return + } + s.queueWrite(msg) + } + + case <-s.closeCh: + s.q = nil + return + } + } +} + +func (s *session) writeLoop() { + defer s.wg.Done() + + for { + select { + case msg := <-s.writeCh: + _ = s.wsconn.SetWriteDeadline(time.Now().Add(WriteTimeout)) + if err := s.wsconn.WriteMessage(websocket.BinaryMessage, msg); err != nil { + s.logger.Warnf("failed to send binary message to client with addr %s, err=%s", err) + s.kill() + return + } + + case <-s.closeCh: + return + } + } +} + +func (s *session) kill() { + if atomic.SwapInt32(&s.closed, 1) == 0 { + close(s.closeCh) + _ = s.wsconn.Close() + } +} + +func (s *session) readLoop() { + defer s.wg.Done() + + for { + mt, message, err := s.wsconn.ReadMessage() + switch err.(type) { + case nil: + case *websocket.CloseError: + s.logger.Warnf("connection closed; err: %s", err) + s.kill() + return + default: + s.logger.Warnf("failed to read message from ws connection; err: %s", err) + s.kill() + return + } + + s.logger.Debugf("received message from ws connection; type: %d; recv: %x", mt, message) + + cmd := new(pb.ClientCommand) + if err := cmd.Unmarshal(message); err != nil { + s.logger.Warnf("failed to read client message; err: %s", err) + s.kill() + return + } + + select { + case s.commandCh <- cmd: + case <-s.closeCh: + return + } + } +} + +func (s *session) handleHelloCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client had already greeted server")) + } + s.greeted = true + if cmd.Config != nil { + s.config = s.validateConfig(*cmd.Config) + } + resp := createCmdOKResp(cmd) + resp.Payload.(*pb.ServerMessage_Response).Response.EffectiveConfig = s.config + return resp +} + +func (s *session) handleRequestCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if !s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client has not greeted server yet")) + } + + var ( + bytes []byte + err error + ) + switch cmd.Source { + case pb.ClientCommand_EVENTS: + err = fmt.Errorf("illegal request for events messages") + case pb.ClientCommand_RUNTIME: + bytes, err = s.server.createRuntimeMsg() + case pb.ClientCommand_STATE: + bytes, err = s.server.createStateMsg() + } + if err != nil { + return createCmdErrorResp(cmd, err) + } + s.writeCh <- bytes + return nil // response is the actual requested payload +} + +func (s *session) handlePushEnableCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if !s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client has not greeted server yet")) + } + + switch cmd.Source { + case pb.ClientCommand_STATE: + if s.pushingState { + break // do nothing + } + s.pushingState = true + s.stateTicker = s.server.clock.Ticker(time.Duration(s.config.StateSnapshotIntervalMs) * time.Millisecond) + case pb.ClientCommand_EVENTS: + s.pushingEvents = true + default: + return createCmdErrorResp(cmd, fmt.Errorf("specified source does not support pushing")) + } + return createCmdOKResp(cmd) +} + +func (s *session) handlePushDisableCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if !s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client has not greeted server yet")) + } + + switch cmd.Source { + case pb.ClientCommand_STATE: + if !s.pushingState { + break // do nothing + } + s.pushingState = false + s.stateTicker.Stop() + case pb.ClientCommand_EVENTS: + s.pushingEvents = false + default: + return createCmdErrorResp(cmd, fmt.Errorf("specified source does not support pushing")) + } + + // if all pushers are disabled, clear the queue. + if !s.pushingState && !s.pushingEvents { + s.q = nil + } + + return createCmdOKResp(cmd) +} + +func (s *session) handlePushPauseCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if !s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client has not greeted server yet")) + } + + s.paused = true + return createCmdOKResp(cmd) +} + +func (s *session) handlePushResumeCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if !s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client has not greeted server yet")) + } + + if !s.paused { + // if we are not paused, there's nothing to do. + return createCmdOKResp(cmd) + } + + msg := createCmdOKResp(cmd) + bytes, err := msg.Marshal() + if err != nil { + s.logger.Warnf("failed to marshal client message; err: %s", err) + s.kill() + return nil + } + + s.queueWrite(bytes) + for _, msg := range s.q { + s.queueWrite(msg.payload) + } + + s.q = nil + s.paused = false + return nil +} + +func (s *session) handleUpdateConfigCmd(cmd *pb.ClientCommand) *pb.ServerMessage { + if !s.greeted { + return createCmdErrorResp(cmd, fmt.Errorf("client has not greeted server yet")) + } + + if cmd.Config == nil { + return createCmdErrorResp(cmd, fmt.Errorf("client passed nil configuration")) + } + + old, neu := s.config, cmd.Config + neu = s.validateConfig(*neu) + + if s.pushingState && old.StateSnapshotIntervalMs != neu.StateSnapshotIntervalMs { + // reset the state ticker to the new interval, if we're pushing state. + s.stateTicker.Stop() + s.stateTicker = s.server.clock.Ticker(time.Duration(neu.StateSnapshotIntervalMs) * time.Millisecond) + } + + s.config = neu + resp := createCmdOKResp(cmd) + resp.Payload.(*pb.ServerMessage_Response).Response.EffectiveConfig = s.config + return resp +} + +func (s *session) validateConfig(config pb.Configuration) *pb.Configuration { + if min := uint64(MinStateSnapshotInterval.Milliseconds()); config.StateSnapshotIntervalMs < min { + config.StateSnapshotIntervalMs = min + } + if max := uint64(MaxRetentionPeriod.Milliseconds()); config.RetentionPeriodMs > max { + config.RetentionPeriodMs = max + } + return &config +} + +func createCmdErrorResp(cmd *pb.ClientCommand, err error) *pb.ServerMessage { + return &pb.ServerMessage{ + Version: introspection.ProtoVersionPb, + Payload: &pb.ServerMessage_Response{ + Response: &pb.CommandResponse{ + Id: cmd.Id, + Result: pb.CommandResponse_ERR, + Error: err.Error(), + }, + }, + } +} + +func createCmdOKResp(cmd *pb.ClientCommand) *pb.ServerMessage { + return &pb.ServerMessage{ + Version: introspection.ProtoVersionPb, + Payload: &pb.ServerMessage_Response{ + Response: &pb.CommandResponse{ + Id: cmd.Id, + Result: pb.CommandResponse_OK, + }, + }, + } +} diff --git a/introspect_test.go b/introspect_test.go index 228f2074d5..3d0ad54a63 100644 --- a/introspect_test.go +++ b/introspect_test.go @@ -39,7 +39,7 @@ func TestIntrospector(t *testing.T) { iaddr := "127.0.0.1:0" ctx := context.Background() - // create host 1 with introspector + // create host 1 with introspect h1, err := New(ctx, Introspector( introspector.NewDefaultIntrospector(), @@ -108,7 +108,7 @@ func TestIntrospector(t *testing.T) { _, err = io.ReadFull(s2, buf) require.NoError(err) - // create a connection with the introspection server + // create a connection with the introspect server addrs := h1.(host.IntrospectableHost).IntrospectionEndpoint().ListenAddrs() url := fmt.Sprintf("ws://%s/introspect", addrs[0]) diff --git a/options.go b/options.go index 9a818ec120..ecb8e7eca3 100644 --- a/options.go +++ b/options.go @@ -196,17 +196,17 @@ func ConnectionManager(connman connmgr.ConnManager) Option { } } -// Introspector configures the host to use the given introspector, and the +// Introspector configures the host to use the given introspect, and the // supplied endpoint constructor. // // Example: // -// import "github.com/libp2p/go-libp2p-introspector" +// import "github.com/libp2p/go-libp2p-introspect" // // host, err := libp2p.New( // libp2p.Introspector( -// introspector.NewDefaultIntrospector(), -// introspector.WsEndpointWithConfig(&introspector.WsEndpointConfig{}), +// introspect.NewDefaultIntrospector(), +// introspect.WsEndpointWithConfig(&introspect.WsEndpointConfig{}), // ), // ) // diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 0cb4f894c9..624df6d39d 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -3,14 +3,13 @@ package basichost import ( "context" "fmt" - "github.com/libp2p/go-libp2p-core/introspection" - introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" "io" "net" - "runtime" "sync" "time" + "github.com/libp2p/go-libp2p-core/introspection" + "github.com/libp2p/go-libp2p/p2p/protocol/identify" "github.com/libp2p/go-libp2p/p2p/protocol/ping" @@ -22,9 +21,10 @@ import ( "github.com/libp2p/go-libp2p-core/peerstore" "github.com/libp2p/go-libp2p-core/protocol" - "github.com/libp2p/go-eventbus" inat "github.com/libp2p/go-libp2p-nat" + "github.com/libp2p/go-eventbus" + logging "github.com/ipfs/go-log" ma "github.com/multiformats/go-multiaddr" @@ -142,8 +142,8 @@ type HostOpts struct { // providers and fetch the current state. Introspector introspection.Introspector - // IntrospectionEndpoint is the introspection endpoint through which - // introspection data is served to clients. + // IntrospectionEndpoint is the introspect endpoint through which + // introspect data is served to clients. IntrospectionEndpoint introspection.Endpoint } @@ -176,29 +176,22 @@ func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHo h.mux = opts.MultistreamMuxer } - // start introspection server - h.introspectionEndpoint = opts.IntrospectionEndpoint - if h.introspector != nil { - runtimeDataProvider := func() (*introspection_pb.Runtime, error) { - return &introspection_pb.Runtime{ - Implementation: "go-libp2p", - Platform: runtime.GOOS, - PeerId: h.ID().Pretty(), - Version: "", - }, nil - } + // KKK + /* // start introspect server + h.introspectionEndpoint = opts.IntrospectionEndpoint + if h.introspector != nil { - // register runtime provider - provs := &introspection.DataProviders{Runtime: runtimeDataProvider} - if err := h.introspector.RegisterDataProviders(provs); err != nil { - log.Errorf("failed to register a runtime provider, err=%s", err) - return nil, fmt.Errorf("failed to register a runtime provider, err-%s", err) - } - } + // register runtime provider + provs := &introspection.DataProviders{Runtime: runtimeDataProvider} + if err := h.introspector.RegisterDataProviders(provs); err != nil { + log.Errorf("failed to register a runtime provider, err=%s", err) + return nil, fmt.Errorf("failed to register a runtime provider, err-%s", err) + } + }*/ if h.introspectionEndpoint != nil { - if err := h.introspectionEndpoint.Start(h.eventbus); err != nil { - return nil, fmt.Errorf("failed to start introspection endpoint: %w", err) + if err := h.introspectionEndpoint.Start(); err != nil { + return nil, fmt.Errorf("failed to start introspect endpoint: %w", err) } } @@ -871,7 +864,7 @@ func (h *BasicHost) Close() error { if h.introspectionEndpoint != nil { if err := h.introspectionEndpoint.Close(); err != nil { - log.Errorf("failed while shutting down introspection endpoint; err: %s", err) + log.Errorf("failed while shutting down introspect endpoint; err: %s", err) } } diff --git a/p2p/net/mock/mock_conn.go b/p2p/net/mock/mock_conn.go index 6bde1ea2dc..d2780e410c 100644 --- a/p2p/net/mock/mock_conn.go +++ b/p2p/net/mock/mock_conn.go @@ -2,7 +2,9 @@ package mocknet import ( "container/list" + "strconv" "sync" + "sync/atomic" process "github.com/jbenet/goprocess" ic "github.com/libp2p/go-libp2p-core/crypto" @@ -12,12 +14,16 @@ import ( manet "github.com/multiformats/go-multiaddr-net" ) +var connCounter int64 + // conn represents one side's perspective of a // live connection between two peers. // it goes over a particular link. type conn struct { notifLk sync.Mutex + id int64 + local peer.ID remote peer.ID @@ -43,6 +49,7 @@ func newConn(p process.Process, ln, rn *peernet, l *link, dir network.Direction) c.local = ln.peer c.remote = rn.peer c.stat = network.Stat{Direction: dir} + c.id = atomic.AddInt64(&connCounter, 1) c.localAddr = ln.ps.Addrs(ln.peer)[0] for _, a := range rn.ps.Addrs(rn.peer) { @@ -61,6 +68,10 @@ func newConn(p process.Process, ln, rn *peernet, l *link, dir network.Direction) return c } +func (c *conn) ID() string { + return strconv.FormatInt(c.id, 10) +} + func (c *conn) Close() error { return c.pairProc.Close() } diff --git a/p2p/net/mock/mock_stream.go b/p2p/net/mock/mock_stream.go index ecb32ddbbf..9ddf5eedf2 100644 --- a/p2p/net/mock/mock_stream.go +++ b/p2p/net/mock/mock_stream.go @@ -5,6 +5,7 @@ import ( "errors" "io" "net" + "strconv" "sync" "sync/atomic" "time" @@ -14,12 +15,15 @@ import ( protocol "github.com/libp2p/go-libp2p-core/protocol" ) +var streamCounter int64 + // stream implements network.Stream type stream struct { notifLk sync.Mutex rstream *stream conn *conn + id int64 write *io.PipeWriter read *io.PipeReader @@ -57,6 +61,7 @@ func newStream(w *io.PipeWriter, r *io.PipeReader, dir network.Direction) *strea s := &stream{ read: r, write: w, + id: atomic.AddInt64(&streamCounter, 1), reset: make(chan struct{}, 1), close: make(chan struct{}, 1), closed: make(chan struct{}), @@ -86,6 +91,10 @@ func (s *stream) Write(p []byte) (n int, err error) { return len(p), nil } +func (s *stream) ID() string { + return strconv.FormatInt(s.id, 10) +} + func (s *stream) Protocol() protocol.ID { // Ignore type error. It means that the protocol is unset. p, _ := s.protocol.Load().(protocol.ID) From cb6b9c1b839b3efbc4e76bcb31939ef090507ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 4 Jun 2020 20:23:06 +0100 Subject: [PATCH 24/32] minor fixes. --- introspect/default_inspector.go | 2 +- introspect/ws/session.go | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/introspect/default_inspector.go b/introspect/default_inspector.go index 9826973405..51d3f52213 100644 --- a/introspect/default_inspector.go +++ b/introspect/default_inspector.go @@ -32,7 +32,7 @@ type DefaultIntrospector struct { closeWg sync.WaitGroup } -func NewDefaultIntrospector(host host.Host, reporter metrics.Reporter) (*DefaultIntrospector, error) { +func NewDefaultIntrospector(host host.Host, reporter metrics.Reporter) (introspection.Introspector, error) { bus := host.EventBus() if bus == nil { return nil, fmt.Errorf("introspector requires a host with eventbus capability") diff --git a/introspect/ws/session.go b/introspect/ws/session.go index fe45ee89ce..2b9b7f2c35 100644 --- a/introspect/ws/session.go +++ b/introspect/ws/session.go @@ -37,6 +37,11 @@ var ( } ) +type qitem struct { + ts time.Time + payload []byte +} + type session struct { server *Endpoint wsconn *websocket.Conn @@ -54,10 +59,7 @@ type session struct { greeted bool config *pb.Configuration - q []struct { - ts time.Time - payload []byte - } + q []*qitem wg sync.WaitGroup closed int32 @@ -128,6 +130,10 @@ func (s *session) control() { s.logger.Warnf("failed to generate state message on tick; err: %s", err) continue } + if s.paused { + s.q = append(s.q, &qitem{time.Now(), msg}) + continue + } s.queueWrite(msg) case now := <-pruneQTicker.C: @@ -146,10 +152,7 @@ func (s *session) control() { continue } if s.paused { - s.q = append(s.q, struct { - ts time.Time - payload []byte - }{time.Now(), evt}) + s.q = append(s.q, &qitem{time.Now(), evt}) continue } s.queueWrite(evt) @@ -345,7 +348,7 @@ func (s *session) handlePushResumeCmd(cmd *pb.ClientCommand) *pb.ServerMessage { } msg := createCmdOKResp(cmd) - bytes, err := msg.Marshal() + bytes, err := envelopePacket(msg) if err != nil { s.logger.Warnf("failed to marshal client message; err: %s", err) s.kill() From 099c00d4bc4dcfe7793c763ea5ebea594b644863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 4 Jun 2020 20:26:33 +0100 Subject: [PATCH 25/32] remove replace directives from go.mod. --- go.mod | 28 ++++++++---- go.sum | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 5067479f13..7b6281c58f 100644 --- a/go.mod +++ b/go.mod @@ -2,14 +2,10 @@ module github.com/libp2p/go-libp2p go 1.12 -replace github.com/libp2p/go-libp2p-core => ../go-libp2p-core - -replace github.com/libp2p/go-libp2p-swarm => ../go-libp2p-swarm - -replace github.com/libp2p/go-eventbus => ../go-eventbus - require ( + github.com/Kubuxu/go-os-helper v0.0.1 // indirect github.com/benbjohnson/clock v1.0.2 + github.com/go-check/check v0.0.0-20180628173108-788fd7840127 // indirect github.com/gogo/protobuf v1.3.1 github.com/gorilla/websocket v1.4.2 github.com/ipfs/go-cid v0.0.6 @@ -17,35 +13,47 @@ require ( github.com/ipfs/go-ipfs-util v0.0.1 github.com/ipfs/go-log v1.0.4 github.com/ipfs/go-log/v2 v2.1.1 + github.com/jackpal/gateway v1.0.5 // indirect github.com/jbenet/go-cienv v0.1.0 github.com/jbenet/goprocess v0.1.4 + github.com/libp2p/go-addr-util v0.0.2 // indirect github.com/libp2p/go-conn-security-multistream v0.2.0 - github.com/libp2p/go-eventbus v0.1.0 + github.com/libp2p/go-eventbus v0.2.0 github.com/libp2p/go-libp2p-autonat v0.2.3 - github.com/libp2p/go-libp2p-blankhost v0.1.6 + github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.2.3 - github.com/libp2p/go-libp2p-core v0.5.7 + github.com/libp2p/go-libp2p-core v0.5.7-0.20200604161422-c4abf7155452 github.com/libp2p/go-libp2p-discovery v0.4.0 github.com/libp2p/go-libp2p-introspector v0.0.4 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 github.com/libp2p/go-libp2p-netutil v0.1.0 + github.com/libp2p/go-libp2p-peer v0.2.0 // indirect github.com/libp2p/go-libp2p-peerstore v0.2.4 + github.com/libp2p/go-libp2p-quic-transport v0.5.0 // indirect github.com/libp2p/go-libp2p-secio v0.2.2 - github.com/libp2p/go-libp2p-swarm v0.2.3 + github.com/libp2p/go-libp2p-swarm v0.2.7-0.20200604192235-7238a81311c6 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-tls v0.1.3 github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 github.com/libp2p/go-libp2p-yamux v0.2.8 + github.com/libp2p/go-stream-muxer v0.0.1 // indirect github.com/libp2p/go-stream-muxer-multistream v0.3.0 github.com/libp2p/go-tcp-transport v0.2.0 github.com/libp2p/go-ws-transport v0.3.1 + github.com/miekg/dns v1.1.28 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-multiaddr v0.2.2 github.com/multiformats/go-multiaddr-dns v0.2.0 github.com/multiformats/go-multiaddr-net v0.1.5 github.com/multiformats/go-multistream v0.1.1 github.com/stretchr/testify v1.6.0 + github.com/whyrusleeping/go-logging v0.0.1 // indirect + github.com/whyrusleeping/mafmt v1.2.8 // indirect github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 + github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect go.uber.org/zap v1.15.0 + golang.org/x/crypto v0.0.0-20200602180216-279210d13fed // indirect + golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 // indirect ) diff --git a/go.sum b/go.sum index 5f372dde1f..b713af3795 100644 --- a/go.sum +++ b/go.sum @@ -20,9 +20,13 @@ github.com/benbjohnson/clock v1.0.2 h1:Z0CN0Yb4ig9sGPXkvAQcGJfnrrMQ5QYLCMPRi9iD7 github.com/benbjohnson/clock v1.0.2/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= +github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= @@ -37,6 +41,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -48,6 +53,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 h1:6xT9KW8zLC5IlbaIF5Q7JNieBoACT7iW0YTxQHR0in0= github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= +github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= @@ -65,6 +71,7 @@ github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclK github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -110,6 +117,7 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -121,7 +129,10 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.6 h1:go0y+GcDOGeJIV01FeBsta4FHngoA4Wz7KMeLkXAhMs= github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= @@ -132,6 +143,7 @@ github.com/ipfs/go-datastore v0.4.4/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13X github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= +github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE= github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= @@ -168,13 +180,16 @@ github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0 github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -184,6 +199,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= github.com/libp2p/go-addr-util v0.0.2 h1:7cWK5cdA5x72jX0g8iLrQWm5TRJZ6CzGdPEhWj7plWU= github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= @@ -192,32 +208,96 @@ github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoR github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= github.com/libp2p/go-conn-security-multistream v0.2.0 h1:uNiDjS58vrvJTg9jO6bySd1rMKejieG7v45ekqHbZ1M= github.com/libp2p/go-conn-security-multistream v0.2.0/go.mod h1:hZN4MjlNetKD3Rq5Jb/P5ohUnFLNzEAR4DLSzpn2QLU= +github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= +github.com/libp2p/go-eventbus v0.2.0 h1:6tCKJBkJKVgAvy/0MLPvU55M3D1Y8uo2m8e1dPwUmOo= +github.com/libp2p/go-eventbus v0.2.0/go.mod h1:Ptlq8GCVEDe1ooZepb+k1RRy+KRAV55LuIvWg7zwoco= +github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc= +github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= +github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZkfEI5sT54= github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k= github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw= github.com/libp2p/go-libp2p v0.8.3/go.mod h1:EsH1A+8yoWK+L4iKcbPYu6MPluZ+CHWI9El8cTaefiM= +github.com/libp2p/go-libp2p-autonat v0.0.1/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= +github.com/libp2p/go-libp2p-autonat v0.0.2/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= +github.com/libp2p/go-libp2p-autonat v0.0.3/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= +github.com/libp2p/go-libp2p-autonat v0.0.4/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= +github.com/libp2p/go-libp2p-autonat v0.0.5/go.mod h1:cKt+qOSnWAZp0dqIuUk62v0/QAPw0vnLuVZnmzkOXRk= +github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE= +github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE= github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI= github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI= github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A= github.com/libp2p/go-libp2p-autonat v0.2.3 h1:w46bKK3KTOUWDe5mDYMRjJu1uryqBp8HCNDp/TWMqKw= github.com/libp2p/go-libp2p-autonat v0.2.3/go.mod h1:2U6bNWCNsAG9LEbwccBDQbjzQ8Krdjge1jLTE9rdoMM= +github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= +github.com/libp2p/go-libp2p-blankhost v0.1.2/go.mod h1:ibwZioa1iHUMotliJMthahrnDNFY9kvedaxZzHQuKIg= +github.com/libp2p/go-libp2p-blankhost v0.1.3/go.mod h1:KML1//wiKR8vuuJO0y3LUd1uLv+tlkGTAr3jC0S5cLg= +github.com/libp2p/go-libp2p-blankhost v0.1.4 h1:I96SWjR4rK9irDHcHq3XHN6hawCRTPUADzkJacgZLvk= github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= +github.com/libp2p/go-libp2p-blankhost v0.1.5/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ= github.com/libp2p/go-libp2p-blankhost v0.1.6 h1:CkPp1/zaCrCnBo0AdsQA0O1VkUYoUOtyHOnoa8gKIcE= github.com/libp2p/go-libp2p-blankhost v0.1.6/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ= +github.com/libp2p/go-libp2p-circuit v0.0.1/go.mod h1:Dqm0s/BiV63j8EEAs8hr1H5HudqvCAeXxDyic59lCwE= +github.com/libp2p/go-libp2p-circuit v0.0.2/go.mod h1:zV136p4UQ76qH/Wj+X/Hivcg6sf6Yb1G7YL8o+GGj38= +github.com/libp2p/go-libp2p-circuit v0.0.3/go.mod h1:p1cHJnB9xnX5/1vZLkXgKwmNEOQQuF/Hp+SkATXnXYk= +github.com/libp2p/go-libp2p-circuit v0.0.4/go.mod h1:p1cHJnB9xnX5/1vZLkXgKwmNEOQQuF/Hp+SkATXnXYk= +github.com/libp2p/go-libp2p-circuit v0.0.5/go.mod h1:p1cHJnB9xnX5/1vZLkXgKwmNEOQQuF/Hp+SkATXnXYk= +github.com/libp2p/go-libp2p-circuit v0.0.6/go.mod h1:W34ISBRpoCPUeOR26xzTbLo+s3hDO9153hJCfvHzBlg= +github.com/libp2p/go-libp2p-circuit v0.0.7/go.mod h1:DFCgZ2DklFGTUIZIhSvbbWXTErUgjyNrJGfDHOrTKIA= +github.com/libp2p/go-libp2p-circuit v0.0.8/go.mod h1:DFCgZ2DklFGTUIZIhSvbbWXTErUgjyNrJGfDHOrTKIA= +github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= +github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= +github.com/libp2p/go-libp2p-circuit v0.1.1/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= +github.com/libp2p/go-libp2p-circuit v0.1.2/go.mod h1:nKVMY/Vp+zcuEGuEoFzRhzb/dMqs+1g3Jxd9qssM5RM= +github.com/libp2p/go-libp2p-circuit v0.1.3/go.mod h1:Xqh2TjSy8DD5iV2cCOMzdynd6h8OTBGoV1AWbWor3qM= github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= +github.com/libp2p/go-libp2p-circuit v0.2.0/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= github.com/libp2p/go-libp2p-circuit v0.2.2/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= github.com/libp2p/go-libp2p-circuit v0.2.3 h1:3Uw1fPHWrp1tgIhBz0vSOxRUmnKL8L/NGUyEd5WfSGM= github.com/libp2p/go-libp2p-circuit v0.2.3/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= +github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= +github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= +github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= +github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= +github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= +github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= +github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= +github.com/libp2p/go-libp2p-core v0.3.1/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= +github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= +github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= +github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-core v0.5.2/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-core v0.5.5/go.mod h1:vj3awlOr9+GMZJFH9s4mpt9RHHgGqeHCopzbYKZdRjM= +github.com/libp2p/go-libp2p-core v0.5.6/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= +github.com/libp2p/go-libp2p-core v0.5.7-0.20200520143746-39497bae12c5/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= +github.com/libp2p/go-libp2p-core v0.5.7-0.20200604161422-c4abf7155452 h1:xYuKN86ZZMdQCdJeeYYVMD69zcjrR3TsvCBTkUilD7k= +github.com/libp2p/go-libp2p-core v0.5.7-0.20200604161422-c4abf7155452/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= +github.com/libp2p/go-libp2p-core v0.5.7 h1:QK3xRwFxqd0Xd9bSZL+8yZ8ncZZbl6Zngd/+Y+A6sgQ= +github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= +github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= +github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= +github.com/libp2p/go-libp2p-discovery v0.0.1/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= +github.com/libp2p/go-libp2p-discovery v0.0.2/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= +github.com/libp2p/go-libp2p-discovery v0.0.3/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= +github.com/libp2p/go-libp2p-discovery v0.0.4/go.mod h1:ReQGiv7QTtza8FUWzewfuMmRDVOQVp+lxHlJJA8YQCM= +github.com/libp2p/go-libp2p-discovery v0.0.5/go.mod h1:YtF20GUxjgoKZ4zmXj8j3Nb2TUSBHFlOCetzYdbZL5I= +github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= github.com/libp2p/go-libp2p-discovery v0.4.0 h1:dK78UhopBk48mlHtRCzbdLm3q/81g77FahEBTjcqQT8= github.com/libp2p/go-libp2p-discovery v0.4.0/go.mod h1:bZ0aJSrFc/eX2llP0ryhb1kpgkPyTo23SJ5b7UQCMh4= +github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go= +github.com/libp2p/go-libp2p-host v0.0.3/go.mod h1:Y/qPyA6C8j2coYyos1dfRm0I8+nvd4TGrDGt4tA7JR8= +github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= +github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= github.com/libp2p/go-libp2p-introspector v0.0.4 h1:eA5JtLI8FwFUzDRC8waCeNzDZYDbMHyvMrBcHDikXvY= github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+DcpBPgxmlHkQqHLz/zO7g+w= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= @@ -230,10 +310,17 @@ github.com/libp2p/go-libp2p-mplex v0.2.3/go.mod h1:CK3p2+9qH9x+7ER/gWWDYJ3QW5ZxW github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE= github.com/libp2p/go-libp2p-nat v0.0.6 h1:wMWis3kYynCbHoyKLPBEMu4YRLltbm8Mk08HGSfvTkU= github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw= +github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= +github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= +github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= +github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es= github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= +github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= +github.com/libp2p/go-libp2p-peerstore v0.0.6/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= +github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ= github.com/libp2p/go-libp2p-peerstore v0.2.1/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= github.com/libp2p/go-libp2p-peerstore v0.2.2/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= @@ -242,13 +329,23 @@ github.com/libp2p/go-libp2p-peerstore v0.2.4 h1:jU9S4jYN30kdzTpDAR7SlHUD+meDUjTO github.com/libp2p/go-libp2p-peerstore v0.2.4/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= +github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= github.com/libp2p/go-libp2p-quic-transport v0.5.0 h1:BUN1lgYNUrtv4WLLQ5rQmC9MCJ6uEXusezGvYRNoJXE= github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M= +github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= +github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= +github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= github.com/libp2p/go-libp2p-secio v0.2.2 h1:rLLPvShPQAcY6eNurKNZq3eZjPWfU9kXF2eI9jIYdrg= github.com/libp2p/go-libp2p-secio v0.2.2/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncHG0uVwGrwvjYlNY= +github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= +github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= +github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= +github.com/libp2p/go-libp2p-swarm v0.2.7-0.20200604192235-7238a81311c6 h1:IE1omcMROKZ5+JUHzqU4+yBEQpcH0efEHEzlVP5BJKc= +github.com/libp2p/go-libp2p-swarm v0.2.7-0.20200604192235-7238a81311c6/go.mod h1:BjfIGj6/amLTlgyoKKBqepE5026+EYVr45q+SiwqspM= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= +github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-testing v0.1.1 h1:U03z3HnGI7Ni8Xx6ONVZvUFOAzWYmolWf5W5jAOPNmU= github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= @@ -258,6 +355,8 @@ github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07q github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns= github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 h1:q3ULhsknEQ34eVDhv4YwKS8iet69ffs9+Fir6a7weN4= github.com/libp2p/go-libp2p-transport-upgrader v0.3.0/go.mod h1:i+SKzbRnvXdVbU3D1dwydnTmKRPXiAR/fyvi1dXuL4o= +github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= +github.com/libp2p/go-libp2p-yamux v0.2.2/go.mod h1:lIohaR0pT6mOt0AZ0L2dFze9hds9Req3OfS+B+dv4qw= github.com/libp2p/go-libp2p-yamux v0.2.5/go.mod h1:Zpgj6arbyQrmZ3wxSZxfBmbdnWtbZ48OpsfmQVTErwA= github.com/libp2p/go-libp2p-yamux v0.2.7/go.mod h1:X28ENrBMU/nm4I3Nx4sZ4dgjZ6VhLEn0XhIoZ5viCwU= github.com/libp2p/go-libp2p-yamux v0.2.8 h1:0s3ELSLu2O7hWKfX1YjzudBKCP0kZ+m9e2+0veXzkn4= @@ -269,6 +368,7 @@ github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6 github.com/libp2p/go-mplex v0.1.1/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk= github.com/libp2p/go-mplex v0.1.2 h1:qOg1s+WdGLlpkrczDqmhYzyk3vCfsQ8+RxRTQjOZWwI= github.com/libp2p/go-mplex v0.1.2/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk= +github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.4 h1:agEFehY3zWJFUHK6SEMR7UYmk2z6kC3oeCM7ybLhguA= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo= @@ -276,6 +376,9 @@ github.com/libp2p/go-nat v0.0.5 h1:qxnwkco8RLKqVh1NmjQ+tJ8p8khNLFxuElYG/TwqW4Q= github.com/libp2p/go-nat v0.0.5/go.mod h1:B7NxsVNPZmRLvMOwiEO1scOSyjA56zxYAGv1yQgRkEU= github.com/libp2p/go-netroute v0.1.2 h1:UHhB35chwgvcRI392znJA3RCBtZ3MpE3ahNCN5MR4Xg= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= +github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= +github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= +github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-openssl v0.0.5 h1:pQkejVhF0xp08D4CQUcw8t+BFJeXowja6RVcb5p++EA= github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= @@ -289,6 +392,7 @@ github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= github.com/libp2p/go-stream-muxer-multistream v0.3.0 h1:TqnSHPJEIqDEO7h1wZZ0p3DXdvDSiLHQidKKUGZtiOY= github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= +github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= github.com/libp2p/go-tcp-transport v0.2.0 h1:YoThc549fzmNJIh7XjHVtMIFaEDRtIrtWciG5LyYAPo= github.com/libp2p/go-tcp-transport v0.2.0/go.mod h1:vX2U0CnWimU4h0SGSEsg++AzvBcroCGYw28kh94oLe0= @@ -296,6 +400,8 @@ github.com/libp2p/go-ws-transport v0.2.0/go.mod h1:9BHJz/4Q5A9ludYWKoGCFC5gUElzl github.com/libp2p/go-ws-transport v0.3.0/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk= github.com/libp2p/go-ws-transport v0.3.1 h1:ZX5rWB8nhRRJVaPO6tmkGI/Xx8XNboYX20PW5hXIscw= github.com/libp2p/go-ws-transport v0.3.1/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk= +github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= +github.com/libp2p/go-yamux v1.3.0/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.5/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.7 h1:v40A1eSPJDIZwz2AvrV3cxpTZEGDP11QJbukmEhYyQI= @@ -304,13 +410,17 @@ github.com/lucas-clemente/quic-go v0.16.0 h1:jJw36wfzGJhmOhAOaOC2lS36WgeqXQszH47 github.com/lucas-clemente/quic-go v0.16.0/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= github.com/marten-seemann/qtls v0.9.1 h1:O0YKQxNVPaiFgMng0suWEOY2Sb4LT2sRn9Qimq3Z1IQ= github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.28 h1:gQhy5bsJa8zTlVI8lywCTZp1lguor+xevFoYlzeCTQY= @@ -319,6 +429,7 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= @@ -327,9 +438,12 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= @@ -344,8 +458,10 @@ github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z github.com/multiformats/go-multiaddr v0.2.2 h1:XZLDTszBIJe6m0zF6ITBrEcZR73OPUhCBBS9rYAuUzI= github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= +github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= +github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= @@ -362,8 +478,10 @@ github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPw github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= +github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= github.com/multiformats/go-multistream v0.1.1 h1:JlAdpIFhBhGRLxe9W6Om0w++Gd6KMWoFPZL/dEnm9nI= github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38= @@ -427,8 +545,11 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -440,8 +561,11 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -461,8 +585,12 @@ github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 h1:Y1/FEOpaCpD2 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= +github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -482,18 +610,24 @@ go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5 h1:Q7tZBpemrlsc2I7IyODzhtallWRSm4Q0d09pL6XbQtU= golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200602180216-279210d13fed h1:g4KENRiCMEx58Q7/ecwfT0N2o8z35Fnbsjig/Alf2T4= +golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -531,6 +665,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -550,6 +685,8 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -562,6 +699,7 @@ golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -588,6 +726,7 @@ google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -608,6 +747,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= +gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 3426b7d3413fd1e78be41005033e6f811998e109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 12:48:53 +0100 Subject: [PATCH 26/32] update dependencies; minor refactor. --- go.mod | 15 +------- go.sum | 61 ++---------------------------- introspect/default_inspector.go | 67 ++++++++++++++++++++------------- introspect/ws/server.go | 16 +++++--- introspect/ws/session.go | 9 ++--- 5 files changed, 61 insertions(+), 107 deletions(-) diff --git a/go.mod b/go.mod index 7b6281c58f..fd07def206 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,7 @@ module github.com/libp2p/go-libp2p go 1.12 require ( - github.com/Kubuxu/go-os-helper v0.0.1 // indirect github.com/benbjohnson/clock v1.0.2 - github.com/go-check/check v0.0.0-20180628173108-788fd7840127 // indirect github.com/gogo/protobuf v1.3.1 github.com/gorilla/websocket v1.4.2 github.com/ipfs/go-cid v0.0.6 @@ -13,46 +11,37 @@ require ( github.com/ipfs/go-ipfs-util v0.0.1 github.com/ipfs/go-log v1.0.4 github.com/ipfs/go-log/v2 v2.1.1 - github.com/jackpal/gateway v1.0.5 // indirect github.com/jbenet/go-cienv v0.1.0 github.com/jbenet/goprocess v0.1.4 - github.com/libp2p/go-addr-util v0.0.2 // indirect github.com/libp2p/go-conn-security-multistream v0.2.0 github.com/libp2p/go-eventbus v0.2.0 github.com/libp2p/go-libp2p-autonat v0.2.3 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.2.3 - github.com/libp2p/go-libp2p-core v0.5.7-0.20200604161422-c4abf7155452 + github.com/libp2p/go-libp2p-core v0.6.0 github.com/libp2p/go-libp2p-discovery v0.4.0 github.com/libp2p/go-libp2p-introspector v0.0.4 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 github.com/libp2p/go-libp2p-netutil v0.1.0 - github.com/libp2p/go-libp2p-peer v0.2.0 // indirect github.com/libp2p/go-libp2p-peerstore v0.2.4 - github.com/libp2p/go-libp2p-quic-transport v0.5.0 // indirect github.com/libp2p/go-libp2p-secio v0.2.2 - github.com/libp2p/go-libp2p-swarm v0.2.7-0.20200604192235-7238a81311c6 + github.com/libp2p/go-libp2p-swarm v0.2.7 github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-tls v0.1.3 github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 github.com/libp2p/go-libp2p-yamux v0.2.8 - github.com/libp2p/go-stream-muxer v0.0.1 // indirect github.com/libp2p/go-stream-muxer-multistream v0.3.0 github.com/libp2p/go-tcp-transport v0.2.0 github.com/libp2p/go-ws-transport v0.3.1 - github.com/miekg/dns v1.1.28 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-multiaddr v0.2.2 github.com/multiformats/go-multiaddr-dns v0.2.0 github.com/multiformats/go-multiaddr-net v0.1.5 github.com/multiformats/go-multistream v0.1.1 github.com/stretchr/testify v1.6.0 - github.com/whyrusleeping/go-logging v0.0.1 // indirect - github.com/whyrusleeping/mafmt v1.2.8 // indirect github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 - github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect go.uber.org/zap v1.15.0 golang.org/x/crypto v0.0.0-20200602180216-279210d13fed // indirect golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 // indirect diff --git a/go.sum b/go.sum index b713af3795..440baed14c 100644 --- a/go.sum +++ b/go.sum @@ -41,7 +41,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -211,8 +210,6 @@ github.com/libp2p/go-conn-security-multistream v0.2.0/go.mod h1:hZN4MjlNetKD3Rq5 github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= github.com/libp2p/go-eventbus v0.2.0 h1:6tCKJBkJKVgAvy/0MLPvU55M3D1Y8uo2m8e1dPwUmOo= github.com/libp2p/go-eventbus v0.2.0/go.mod h1:Ptlq8GCVEDe1ooZepb+k1RRy+KRAV55LuIvWg7zwoco= -github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc= -github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= @@ -220,43 +217,16 @@ github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZk github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k= github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw= github.com/libp2p/go-libp2p v0.8.3/go.mod h1:EsH1A+8yoWK+L4iKcbPYu6MPluZ+CHWI9El8cTaefiM= -github.com/libp2p/go-libp2p-autonat v0.0.1/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= -github.com/libp2p/go-libp2p-autonat v0.0.2/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= -github.com/libp2p/go-libp2p-autonat v0.0.3/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= -github.com/libp2p/go-libp2p-autonat v0.0.4/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= -github.com/libp2p/go-libp2p-autonat v0.0.5/go.mod h1:cKt+qOSnWAZp0dqIuUk62v0/QAPw0vnLuVZnmzkOXRk= -github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE= github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI= github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI= github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A= github.com/libp2p/go-libp2p-autonat v0.2.3 h1:w46bKK3KTOUWDe5mDYMRjJu1uryqBp8HCNDp/TWMqKw= github.com/libp2p/go-libp2p-autonat v0.2.3/go.mod h1:2U6bNWCNsAG9LEbwccBDQbjzQ8Krdjge1jLTE9rdoMM= -github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-blankhost v0.1.2/go.mod h1:ibwZioa1iHUMotliJMthahrnDNFY9kvedaxZzHQuKIg= -github.com/libp2p/go-libp2p-blankhost v0.1.3/go.mod h1:KML1//wiKR8vuuJO0y3LUd1uLv+tlkGTAr3jC0S5cLg= github.com/libp2p/go-libp2p-blankhost v0.1.4 h1:I96SWjR4rK9irDHcHq3XHN6hawCRTPUADzkJacgZLvk= github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= -github.com/libp2p/go-libp2p-blankhost v0.1.5/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ= -github.com/libp2p/go-libp2p-blankhost v0.1.6 h1:CkPp1/zaCrCnBo0AdsQA0O1VkUYoUOtyHOnoa8gKIcE= -github.com/libp2p/go-libp2p-blankhost v0.1.6/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ= -github.com/libp2p/go-libp2p-circuit v0.0.1/go.mod h1:Dqm0s/BiV63j8EEAs8hr1H5HudqvCAeXxDyic59lCwE= -github.com/libp2p/go-libp2p-circuit v0.0.2/go.mod h1:zV136p4UQ76qH/Wj+X/Hivcg6sf6Yb1G7YL8o+GGj38= -github.com/libp2p/go-libp2p-circuit v0.0.3/go.mod h1:p1cHJnB9xnX5/1vZLkXgKwmNEOQQuF/Hp+SkATXnXYk= -github.com/libp2p/go-libp2p-circuit v0.0.4/go.mod h1:p1cHJnB9xnX5/1vZLkXgKwmNEOQQuF/Hp+SkATXnXYk= -github.com/libp2p/go-libp2p-circuit v0.0.5/go.mod h1:p1cHJnB9xnX5/1vZLkXgKwmNEOQQuF/Hp+SkATXnXYk= -github.com/libp2p/go-libp2p-circuit v0.0.6/go.mod h1:W34ISBRpoCPUeOR26xzTbLo+s3hDO9153hJCfvHzBlg= -github.com/libp2p/go-libp2p-circuit v0.0.7/go.mod h1:DFCgZ2DklFGTUIZIhSvbbWXTErUgjyNrJGfDHOrTKIA= -github.com/libp2p/go-libp2p-circuit v0.0.8/go.mod h1:DFCgZ2DklFGTUIZIhSvbbWXTErUgjyNrJGfDHOrTKIA= -github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-circuit v0.1.1/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-circuit v0.1.2/go.mod h1:nKVMY/Vp+zcuEGuEoFzRhzb/dMqs+1g3Jxd9qssM5RM= -github.com/libp2p/go-libp2p-circuit v0.1.3/go.mod h1:Xqh2TjSy8DD5iV2cCOMzdynd6h8OTBGoV1AWbWor3qM= github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= -github.com/libp2p/go-libp2p-circuit v0.2.0/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= github.com/libp2p/go-libp2p-circuit v0.2.2/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= github.com/libp2p/go-libp2p-circuit v0.2.3 h1:3Uw1fPHWrp1tgIhBz0vSOxRUmnKL8L/NGUyEd5WfSGM= @@ -277,27 +247,13 @@ github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt github.com/libp2p/go-libp2p-core v0.5.5/go.mod h1:vj3awlOr9+GMZJFH9s4mpt9RHHgGqeHCopzbYKZdRjM= github.com/libp2p/go-libp2p-core v0.5.6/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= github.com/libp2p/go-libp2p-core v0.5.7-0.20200520143746-39497bae12c5/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.5.7-0.20200604161422-c4abf7155452 h1:xYuKN86ZZMdQCdJeeYYVMD69zcjrR3TsvCBTkUilD7k= -github.com/libp2p/go-libp2p-core v0.5.7-0.20200604161422-c4abf7155452/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.5.7 h1:QK3xRwFxqd0Xd9bSZL+8yZ8ncZZbl6Zngd/+Y+A6sgQ= -github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I= +github.com/libp2p/go-libp2p-core v0.6.0 h1:u03qofNYTBN+yVg08PuAKylZogVf0xcTEeM8skGf+ak= +github.com/libp2p/go-libp2p-core v0.6.0/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.0.1/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= -github.com/libp2p/go-libp2p-discovery v0.0.2/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= -github.com/libp2p/go-libp2p-discovery v0.0.3/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= -github.com/libp2p/go-libp2p-discovery v0.0.4/go.mod h1:ReQGiv7QTtza8FUWzewfuMmRDVOQVp+lxHlJJA8YQCM= -github.com/libp2p/go-libp2p-discovery v0.0.5/go.mod h1:YtF20GUxjgoKZ4zmXj8j3Nb2TUSBHFlOCetzYdbZL5I= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg= github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= github.com/libp2p/go-libp2p-discovery v0.4.0 h1:dK78UhopBk48mlHtRCzbdLm3q/81g77FahEBTjcqQT8= github.com/libp2p/go-libp2p-discovery v0.4.0/go.mod h1:bZ0aJSrFc/eX2llP0ryhb1kpgkPyTo23SJ5b7UQCMh4= -github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go= -github.com/libp2p/go-libp2p-host v0.0.3/go.mod h1:Y/qPyA6C8j2coYyos1dfRm0I8+nvd4TGrDGt4tA7JR8= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= github.com/libp2p/go-libp2p-introspector v0.0.4 h1:eA5JtLI8FwFUzDRC8waCeNzDZYDbMHyvMrBcHDikXvY= github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+DcpBPgxmlHkQqHLz/zO7g+w= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= @@ -310,15 +266,9 @@ github.com/libp2p/go-libp2p-mplex v0.2.3/go.mod h1:CK3p2+9qH9x+7ER/gWWDYJ3QW5ZxW github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE= github.com/libp2p/go-libp2p-nat v0.0.6 h1:wMWis3kYynCbHoyKLPBEMu4YRLltbm8Mk08HGSfvTkU= github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw= -github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es= github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.0.6/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ= @@ -329,10 +279,8 @@ github.com/libp2p/go-libp2p-peerstore v0.2.4 h1:jU9S4jYN30kdzTpDAR7SlHUD+meDUjTO github.com/libp2p/go-libp2p-peerstore v0.2.4/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= -github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= github.com/libp2p/go-libp2p-quic-transport v0.5.0 h1:BUN1lgYNUrtv4WLLQ5rQmC9MCJ6uEXusezGvYRNoJXE= github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M= -github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8= @@ -341,8 +289,8 @@ github.com/libp2p/go-libp2p-secio v0.2.2/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncH github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= -github.com/libp2p/go-libp2p-swarm v0.2.7-0.20200604192235-7238a81311c6 h1:IE1omcMROKZ5+JUHzqU4+yBEQpcH0efEHEzlVP5BJKc= -github.com/libp2p/go-libp2p-swarm v0.2.7-0.20200604192235-7238a81311c6/go.mod h1:BjfIGj6/amLTlgyoKKBqepE5026+EYVr45q+SiwqspM= +github.com/libp2p/go-libp2p-swarm v0.2.7 h1:4lV/sf7f0NuVqunOpt1I11+Z54+xp+m0eeAvxj/LyRc= +github.com/libp2p/go-libp2p-swarm v0.2.7/go.mod h1:ZSJ0Q+oq/B1JgfPHJAT2HTall+xYRNYp1xs4S2FBWKA= github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= @@ -481,7 +429,6 @@ github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= github.com/multiformats/go-multistream v0.1.1 h1:JlAdpIFhBhGRLxe9W6Om0w++Gd6KMWoFPZL/dEnm9nI= github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38= diff --git a/introspect/default_inspector.go b/introspect/default_inspector.go index 51d3f52213..b5f7b7e666 100644 --- a/introspect/default_inspector.go +++ b/introspect/default_inspector.go @@ -7,13 +7,16 @@ import ( "sync" "time" - "github.com/libp2p/go-eventbus" "github.com/libp2p/go-libp2p-core/event" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/introspection" pb "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" + "github.com/libp2p/go-libp2p-core/peer" + + "github.com/libp2p/go-eventbus" + "github.com/multiformats/go-multiaddr" ) var _ introspection.Introspector = (*DefaultIntrospector)(nil) @@ -79,31 +82,38 @@ func (d *DefaultIntrospector) FetchRuntime() (*pb.Runtime, error) { } func (d *DefaultIntrospector) FetchFullState() (state *pb.State, err error) { - s := &pb.State{} - - // timestamps - s.StartTs = timeToUnixMillis(d.started) - s.InstantTs = timeToUnixMillis(time.Now()) - d.started = time.Now() + var ( + now = time.Now() + netconns = d.host.Network().Conns() + conns = make([]*pb.Connection, 0, len(netconns)) + traffic *pb.Traffic + ) + + for _, conn := range netconns { + c, err := d.IntrospectConnection(conn) + if err != nil { + return nil, err + } + conns = append(conns, c) + } - // subsystems - s.Subsystems = &pb.Subsystems{} - s.Traffic, err = d.IntrospectGlobalTraffic() + // subsystems and traffic. + traffic, err = d.IntrospectGlobalTraffic() if err != nil { return nil, err } - conns := d.host.Network().Conns() - s.Subsystems.Connections = make([]*pb.Connection, 0, len(conns)) - for _, conn := range conns { - c, err := d.IntrospectConnection(conn) - if err != nil { - return nil, err - } - s.Subsystems.Connections = append(s.Subsystems.Connections, c) + state = &pb.State{ + // timestamps in millis since epoch. + StartTs: uint64(d.started.UnixNano() / int64(time.Millisecond)), + InstantTs: uint64(now.UnixNano() / int64(time.Millisecond)), + Subsystems: &pb.Subsystems{ + Connections: conns, + }, + Traffic: traffic, } - return s, nil + return state, nil } // IntrospectGlobalTraffic introspects and returns total traffic stats for this swarm. @@ -170,8 +180,16 @@ func (d *DefaultIntrospector) IntrospectConnection(conn network.Conn) (*pb.Conne // negotiated anywhere. res.Attribs = &pb.Connection_Attributes{} - // TODO can we get the transport ID from the multiaddr? - res.TransportId = nil + // TransportId with format "ip4+tcp" or "ip6+udp+quic". + res.TransportId = func() []byte { + tptAddr, _ := peer.SplitAddr(conn.RemoteMultiaddr()) + var str string + multiaddr.ForEach(tptAddr, func(c multiaddr.Component) bool { + str += c.Protocol().Name + "+" + return true + }) + return []byte(str[0 : len(str)-1]) + }() // TODO there's the ping protocol, but that's higher than this layer. // How do we source this? We may need some kind of latency manager. @@ -211,9 +229,8 @@ func (d *DefaultIntrospector) IntrospectStream(stream network.Stream) (*pb.Strea OpenTs: openTs, // TODO CloseTs. }, - // TODO Traffic: we are not tracking per-stream traffic stats at the + // TODO Traffic: we are not tracking per-stream traffic stats at the moment. Traffic: &pb.Traffic{TrafficIn: &pb.DataGauge{}, TrafficOut: &pb.DataGauge{}}, - // moment. } return res, nil } @@ -228,7 +245,3 @@ func translateRole(stat network.Stat) pb.Role { return 99 // TODO placeholder value } } - -func timeToUnixMillis(t time.Time) uint64 { - return uint64(t.UnixNano() / 1000000) -} diff --git a/introspect/ws/server.go b/introspect/ws/server.go index 7f24c80c87..0d3dbfd098 100644 --- a/introspect/ws/server.go +++ b/introspect/ws/server.go @@ -10,13 +10,19 @@ import ( "sync" "github.com/libp2p/go-libp2p-core/introspection" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/benbjohnson/clock" "github.com/gorilla/websocket" logging "github.com/ipfs/go-log" ) +// ProtoVersion is the current version of the introspection protocol. +const ProtoVersion uint32 = 1 + +// ProtoVersionPb is the proto representation of the current introspection protocol. +var ProtoVersionPb = &pb.Version{Version: ProtoVersion} + var ( logger = logging.Logger("introspection/ws-server") upgrader = websocket.Upgrader{} @@ -279,7 +285,7 @@ func (e *Endpoint) worker() { func (e *Endpoint) broadcastEvent(evt *pb.Event) error { pkt := &pb.ServerMessage{ - Version: introspection.ProtoVersionPb, + Version: ProtoVersionPb, Payload: &pb.ServerMessage_Event{Event: evt}, } @@ -302,7 +308,7 @@ func (e *Endpoint) createStateMsg() ([]byte, error) { } pkt := &pb.ServerMessage{ - Version: introspection.ProtoVersionPb, + Version: ProtoVersionPb, Payload: &pb.ServerMessage_State{State: st}, } @@ -317,7 +323,7 @@ func (e *Endpoint) createRuntimeMsg() ([]byte, error) { rt.EventTypes = e.introspector.EventMetadata() pkt := &pb.ServerMessage{ - Version: introspection.ProtoVersionPb, + Version: ProtoVersionPb, Payload: &pb.ServerMessage_Runtime{Runtime: rt}, } @@ -338,7 +344,7 @@ func envelopePacket(pkt *pb.ServerMessage) ([]byte, error) { return nil, fmt.Errorf("failed creating fnc hash digest, err: %w", err) } - binary.LittleEndian.PutUint32(buf[0:4], introspection.ProtoVersion) + binary.LittleEndian.PutUint32(buf[0:4], ProtoVersion) binary.LittleEndian.PutUint32(buf[4:8], f.Sum32()) binary.LittleEndian.PutUint32(buf[8:12], uint32(size)) diff --git a/introspect/ws/session.go b/introspect/ws/session.go index 2b9b7f2c35..ef86168e28 100644 --- a/introspect/ws/session.go +++ b/introspect/ws/session.go @@ -6,8 +6,7 @@ import ( "sync/atomic" "time" - "github.com/libp2p/go-libp2p-core/introspection" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/benbjohnson/clock" "github.com/gorilla/websocket" @@ -32,7 +31,7 @@ var ( ConnBufferSize = 1 << 8 DefaultSessionConfig = &pb.Configuration{ - RetentionPeriodMs: uint64(120 * time.Second / time.Millisecond), + RetentionPeriodMs: uint64(MaxRetentionPeriod / time.Millisecond), StateSnapshotIntervalMs: uint64(time.Second / time.Millisecond), } ) @@ -401,7 +400,7 @@ func (s *session) validateConfig(config pb.Configuration) *pb.Configuration { func createCmdErrorResp(cmd *pb.ClientCommand, err error) *pb.ServerMessage { return &pb.ServerMessage{ - Version: introspection.ProtoVersionPb, + Version: ProtoVersionPb, Payload: &pb.ServerMessage_Response{ Response: &pb.CommandResponse{ Id: cmd.Id, @@ -414,7 +413,7 @@ func createCmdErrorResp(cmd *pb.ClientCommand, err error) *pb.ServerMessage { func createCmdOKResp(cmd *pb.ClientCommand) *pb.ServerMessage { return &pb.ServerMessage{ - Version: introspection.ProtoVersionPb, + Version: ProtoVersionPb, Payload: &pb.ServerMessage_Response{ Response: &pb.CommandResponse{ Id: cmd.Id, From 8c891b90453653d731eca4bff452a5cf307034e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 14:17:53 +0100 Subject: [PATCH 27/32] more tests and polishing. --- go.mod | 1 - go.sum | 7 - introspect/default_inspector.go | 9 +- introspect/ws/server_common_test.go | 25 ++- introspect/ws/server_config_test.go | 4 +- introspect/ws/server_hello_test.go | 6 +- .../ws/server_integration_test.go | 138 +++++------------ introspect/ws/server_lifecycle_test.go | 4 +- introspect/ws/server_push_test.go | 146 +++++++++++++++++- introspect/ws/server_request_test.go | 6 +- introspect/ws/session.go | 6 +- 11 files changed, 209 insertions(+), 143 deletions(-) rename introspect_test.go => introspect/ws/server_integration_test.go (50%) diff --git a/go.mod b/go.mod index 8820583ae3..21a2dd81d3 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/libp2p/go-libp2p-circuit v0.2.3 github.com/libp2p/go-libp2p-core v0.6.0 github.com/libp2p/go-libp2p-discovery v0.4.0 - github.com/libp2p/go-libp2p-introspector v0.0.4 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-mplex v0.2.3 github.com/libp2p/go-libp2p-nat v0.0.6 diff --git a/go.sum b/go.sum index 0e479906e3..08dcbfcacd 100644 --- a/go.sum +++ b/go.sum @@ -125,8 +125,6 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= @@ -152,12 +150,10 @@ github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1Y github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I= github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk= github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= github.com/ipfs/go-log v1.0.4 h1:6nLQdX4W8P9yZZFH7mO+X/PzjN8Laozm/lMJ6esdgzY= github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs= -github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= @@ -238,7 +234,6 @@ github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= -github.com/libp2p/go-libp2p-core v0.3.1-0.20200210163958-6d6f8284b841/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-core v0.3.1/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII= github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= @@ -256,8 +251,6 @@ github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfx github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw= github.com/libp2p/go-libp2p-discovery v0.4.0 h1:dK78UhopBk48mlHtRCzbdLm3q/81g77FahEBTjcqQT8= github.com/libp2p/go-libp2p-discovery v0.4.0/go.mod h1:bZ0aJSrFc/eX2llP0ryhb1kpgkPyTo23SJ5b7UQCMh4= -github.com/libp2p/go-libp2p-introspector v0.0.4 h1:eA5JtLI8FwFUzDRC8waCeNzDZYDbMHyvMrBcHDikXvY= -github.com/libp2p/go-libp2p-introspector v0.0.4/go.mod h1:SkaOljzZheY14Y1DA+b+DcpBPgxmlHkQqHLz/zO7g+w= github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= diff --git a/introspect/default_inspector.go b/introspect/default_inspector.go index b5f7b7e666..36201ee57d 100644 --- a/introspect/default_inspector.go +++ b/introspect/default_inspector.go @@ -4,13 +4,12 @@ import ( "fmt" "math" "runtime" - "sync" "time" "github.com/libp2p/go-libp2p-core/event" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/introspection" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" @@ -30,9 +29,6 @@ type DefaultIntrospector struct { wsub event.Subscription reporter metrics.Reporter started time.Time - - closeCh chan struct{} - closeWg sync.WaitGroup } func NewDefaultIntrospector(host host.Host, reporter metrics.Reporter) (introspection.Introspector, error) { @@ -53,11 +49,8 @@ func NewDefaultIntrospector(host host.Host, reporter metrics.Reporter) (introspe wsub: sub, reporter: reporter, started: time.Now(), - closeCh: make(chan struct{}), } - d.closeWg.Add(1) - go d.processEvents() return d, nil } diff --git a/introspect/ws/server_common_test.go b/introspect/ws/server_common_test.go index 160b7b4bed..1b50ef3f58 100644 --- a/introspect/ws/server_common_test.go +++ b/introspect/ws/server_common_test.go @@ -15,14 +15,15 @@ import ( "github.com/libp2p/go-libp2p/introspect" ) -func createTestServer(t *testing.T) (*Endpoint, *introspect.MockIntrospector) { +func createTestServer(t *testing.T) (*Endpoint, *introspect.MockIntrospector, *clock.Mock) { t.Helper() + clk := clock.NewMock() mocki := introspect.NewMockIntrospector() - cfg := &EndpointConfig{ListenAddrs: []string{"localhost:0"}, Clock: clock.NewMock()} + cfg := &EndpointConfig{ListenAddrs: []string{"localhost:0"}, Clock: clk} server, err := NewEndpoint(mocki, cfg) require.NoError(t, err) - return server, mocki + return server, mocki, clk } type connWrapper struct { @@ -30,8 +31,8 @@ type connWrapper struct { t *testing.T } -func createConn(t *testing.T, server *Endpoint) *connWrapper { - addr := fmt.Sprintf("ws://%s/introspect", server.ListenAddrs()[0]) +func createConn(t *testing.T, endpoint introspection.Endpoint) *connWrapper { + addr := fmt.Sprintf("ws://%s/introspect", endpoint.ListenAddrs()[0]) conn, _, err := websocket.DefaultDialer.Dial(addr, nil) require.NoError(t, err) return &connWrapper{conn, t} @@ -74,7 +75,7 @@ func (cw *connWrapper) readNext() *pb.ServerMessage { payload = msg[12:] ) - require.EqualValues(cw.t, introspection.ProtoVersion, binary.LittleEndian.Uint32(version)) + require.EqualValues(cw.t, ProtoVersion, binary.LittleEndian.Uint32(version)) require.EqualValues(cw.t, len(payload), binary.LittleEndian.Uint32(length)) // validate hash. @@ -89,7 +90,17 @@ func (cw *connWrapper) readNext() *pb.ServerMessage { require.NoError(cw.t, smsg.Unmarshal(payload)) require.NotNil(cw.t, smsg.Payload, "nil message received from server") - require.Equal(cw.t, introspection.ProtoVersion, smsg.Version.Version, "incorrect proto version receieved from client") + require.Equal(cw.t, ProtoVersion, smsg.Version.Version, "incorrect proto version receieved from client") return smsg } + +func (cw *connWrapper) consumeCommandResponse(id uint64, result pb.CommandResponse_Result) *pb.CommandResponse { + msg := cw.readNext() + resp := msg.Payload.(*pb.ServerMessage_Response).Response + + require.NotNil(cw.t, resp) + require.EqualValues(cw.t, id, resp.Id) + require.EqualValues(cw.t, result, resp.Result) + return resp +} diff --git a/introspect/ws/server_config_test.go b/introspect/ws/server_config_test.go index 50bb50b45b..344c0ad828 100644 --- a/introspect/ws/server_config_test.go +++ b/introspect/ws/server_config_test.go @@ -9,7 +9,7 @@ import ( ) func TestValidConfiguration(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -47,7 +47,7 @@ func TestValidConfiguration(t *testing.T) { } func TestHelloWithInvalidConfig(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() diff --git a/introspect/ws/server_hello_test.go b/introspect/ws/server_hello_test.go index 69aecd9692..388dbd9092 100644 --- a/introspect/ws/server_hello_test.go +++ b/introspect/ws/server_hello_test.go @@ -9,7 +9,7 @@ import ( ) func TestStartSession(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -20,7 +20,7 @@ func TestStartSession(t *testing.T) { } func TestDoubleHelloFails(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -39,7 +39,7 @@ func TestDoubleHelloFails(t *testing.T) { } func TestNoHelloFails(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() diff --git a/introspect_test.go b/introspect/ws/server_integration_test.go similarity index 50% rename from introspect_test.go rename to introspect/ws/server_integration_test.go index 3d1c399170..b6e6cf8d1e 100644 --- a/introspect_test.go +++ b/introspect/ws/server_integration_test.go @@ -1,25 +1,23 @@ -package libp2p +package ws import ( "context" - "fmt" "io" "runtime" "testing" - "time" "github.com/libp2p/go-libp2p-core/host" - introspection "github.com/libp2p/go-libp2p-core/introspection" - introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/protocol" - introspector "github.com/libp2p/go-libp2p-introspector" - "github.com/gogo/protobuf/proto" - "github.com/gorilla/websocket" + "github.com/libp2p/go-libp2p/introspect" + "github.com/stretchr/testify/require" + + "github.com/libp2p/go-libp2p" ) var ( @@ -32,32 +30,29 @@ var ( p2 = protocol.ID("h2h1") ) -// TODO Send Pause & Send Data -func TestIntrospector(t *testing.T) { +func TestHostIntrospection(t *testing.T) { require := require.New(t) iaddr := "127.0.0.1:0" ctx := context.Background() // create host 1 with introspect - h1, err := New(ctx, - Introspection( - introspector.NewDefaultIntrospector(), - introspector.WsServerWithConfig(&introspector.WsServerConfig{ - ListenAddrs: []string{iaddr}, - }), + h1, err := libp2p.New(ctx, + libp2p.Introspection( + introspect.NewDefaultIntrospector, + EndpointWithConfig(&EndpointConfig{ListenAddrs: []string{iaddr}}), ), - BandwidthReporter(metrics.NewBandwidthCounter()), + libp2p.BandwidthReporter(metrics.NewBandwidthCounter()), ) require.NoError(err) defer h1.Close() // create host 2 - h2, err := New(ctx) + h2, err := libp2p.New(ctx) defer h2.Close() // create host 3 - h3, err := New(ctx) + h3, err := libp2p.New(ctx) defer h3.Close() // host1 -> CONNECTS -> host2 @@ -108,81 +103,29 @@ func TestIntrospector(t *testing.T) { _, err = io.ReadFull(s2, buf) require.NoError(err) - // create a connection with the introspect server - addrs := h1.(host.IntrospectableHost).IntrospectionEndpoint().ListenAddrs() - url := fmt.Sprintf("ws://%s/introspect", addrs[0]) + conn := createConn(t, h1.(host.IntrospectableHost).IntrospectionEndpoint()) + defer conn.Close() - fmt.Println(addrs) + // first, we get the runtime and verify it. + conn.greet() - // wait till connection is established - var connection *websocket.Conn - require.Eventually(func() bool { - connection, _, err = websocket.DefaultDialer.Dial(url, nil) - return err == nil - }, 5*time.Second, 500*time.Millisecond) - defer connection.Close() - - // first, we get the runtime and assert it - pd := fetchProtocolWrapper(require, connection) - rt := pd.GetRuntime() + conn.sendCommand(&pb.ClientCommand{Id: 200, Command: pb.ClientCommand_REQUEST, Source: pb.ClientCommand_RUNTIME}) + msg := conn.readNext() + rt := msg.GetRuntime() require.NotNil(t, rt) require.Equal(h1.ID().String(), rt.PeerId) require.Equal(runtime.GOOS, rt.Platform) require.Equal("go-libp2p", rt.Implementation) - // followed by the state message - pd = fetchProtocolWrapper(require, connection) - st := pd.GetState() + // now we get the state. + conn.sendCommand(&pb.ClientCommand{Id: 200, Command: pb.ClientCommand_REQUEST, Source: pb.ClientCommand_STATE}) + msg = conn.readNext() + st := msg.GetState() require.NotNil(t, st) assertState(require, st, h1, h2, h3, false) - - // we should then periodically get a state message..lets wait for one with traffic - var st2 *introspection_pb.State - require.Eventually(func() bool { - pd = fetchProtocolWrapper(require, connection) - st2 = pd.GetState() - require.NotNil(t, st2) - - if st2.Traffic.TrafficOut.CumBytes != 0 && - st2.Subsystems.Connections[0].Traffic.TrafficOut.CumBytes != 0 && st2.Subsystems.Connections[1].Traffic.TrafficOut.CumBytes != 0 { - return true - } - - return false - }, 10*time.Second, 1500*time.Millisecond) - assertState(require, st2, h1, h2, h3, true) - - // Pause - cl := &introspection_pb.ClientSignal{Signal: introspection_pb.ClientSignal_PAUSE_PUSH_EMITTER} - bz, err := proto.Marshal(cl) - require.NoError(err) - require.NotEmpty(bz) - require.NoError(connection.WriteMessage(websocket.BinaryMessage, bz)) - time.Sleep(1 * time.Second) - - // We get a runtime and state message when we unpause - cl = &introspection_pb.ClientSignal{Signal: introspection_pb.ClientSignal_UNPAUSE_PUSH_EMITTER} - bz, err = proto.Marshal(cl) - require.NoError(err) - require.NotEmpty(bz) - require.NoError(connection.WriteMessage(websocket.BinaryMessage, bz)) - - require.Eventually(func() bool { - pd = fetchProtocolWrapper(require, connection) - - return pd.GetRuntime() != nil && pd.GetState() == nil - }, 10*time.Second, 1*time.Second) - - require.Eventually(func() bool { - pd = fetchProtocolWrapper(require, connection) - - return pd.GetState() != nil && pd.GetRuntime() == nil - }, 10*time.Second, 1*time.Second) - - assertState(require, pd.GetState(), h1, h2, h3, true) } -func assertState(require *require.Assertions, state *introspection_pb.State, h1, h2, h3 host.Host, +func assertState(require *require.Assertions, state *pb.State, h1, h2, h3 host.Host, assertTraffic bool) { if assertTraffic { @@ -192,7 +135,7 @@ func assertState(require *require.Assertions, state *introspection_pb.State, h1, // Connections conns := state.Subsystems.Connections - peerIdToConns := make(map[string]*introspection_pb.Connection) + peerIdToConns := make(map[string]*pb.Connection) for _, c := range conns { peerIdToConns[c.PeerId] = c } @@ -207,10 +150,10 @@ func assertState(require *require.Assertions, state *introspection_pb.State, h1, // host1 -> host2 connection h2Conn := peerIdToConns[h2.ID().String()] require.NotEmpty(h2Conn.Id) - require.Equal(introspection_pb.Status_ACTIVE, h2Conn.Status) + require.Equal(pb.Status_ACTIVE, h2Conn.Status) require.Equal(pconn[h2.ID().String()].LocalMultiaddr().String(), h2Conn.Endpoints.SrcMultiaddr) require.Equal(pconn[h2.ID().String()].RemoteMultiaddr().String(), h2Conn.Endpoints.DstMultiaddr) - require.Equal(introspection_pb.Role_INITIATOR, h2Conn.Role) + require.Equal(pb.Role_INITIATOR, h2Conn.Role) if assertTraffic { require.Greater(h2Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg3))) @@ -219,10 +162,10 @@ func assertState(require *require.Assertions, state *introspection_pb.State, h1, // host3 -> host1 connection h3Conn := peerIdToConns[h3.ID().String()] require.NotEmpty(h3Conn.Id) - require.Equal(introspection_pb.Status_ACTIVE, h3Conn.Status) + require.Equal(pb.Status_ACTIVE, h3Conn.Status) require.Equal(pconn[h3.ID().String()].LocalMultiaddr().String(), h3Conn.Endpoints.SrcMultiaddr) require.Equal(pconn[h3.ID().String()].RemoteMultiaddr().String(), h3Conn.Endpoints.DstMultiaddr) - require.Equal(introspection_pb.Role_RESPONDER, h3Conn.Role) + require.Equal(pb.Role_RESPONDER, h3Conn.Role) if assertTraffic { require.Greater(h3Conn.Traffic.TrafficIn.CumBytes, uint64(len(msg2))) @@ -233,8 +176,8 @@ func assertState(require *require.Assertions, state *introspection_pb.State, h1, h3Stream := h3Conn.Streams.Streams[0] require.NotEmpty(h3Stream.Id) require.Equal(string(p1), h3Stream.Protocol) - require.Equal(introspection_pb.Role_INITIATOR, h3Stream.Role) - require.Equal(introspection_pb.Status_ACTIVE, h3Stream.Status) + require.Equal(pb.Role_INITIATOR, h3Stream.Role) + require.Equal(pb.Status_ACTIVE, h3Stream.Status) // require.True(len(msg1) == int(h3Stream.Traffic.TrafficOut.CumBytes)) // require.True(len(msg2) == int(h3Stream.Traffic.TrafficIn.CumBytes)) @@ -243,18 +186,7 @@ func assertState(require *require.Assertions, state *introspection_pb.State, h1, h1Stream := h2Conn.Streams.Streams[0] require.NotEmpty(h1Stream.Id) require.Equal(string(p2), h1Stream.Protocol) - require.Equal(introspection_pb.Role_RESPONDER, h1Stream.Role) - require.Equal(introspection_pb.Status_ACTIVE, h1Stream.Status) + require.Equal(pb.Role_RESPONDER, h1Stream.Role) + require.Equal(pb.Status_ACTIVE, h1Stream.Status) // require.True(len(msg3) == int(h1Stream.Traffic.TrafficIn.CumBytes)) } - -func fetchProtocolWrapper(require *require.Assertions, conn *websocket.Conn) *introspection_pb.ProtocolDataPacket { - _, msg, err := conn.ReadMessage() - require.NoError(err) - require.NotEmpty(msg) - pd := &introspection_pb.ProtocolDataPacket{} - require.NoError(proto.Unmarshal(msg[12:], pd)) - require.NotNil(pd.Message) - require.Equal(introspection.ProtoVersion, pd.Version.Version) - return pd -} diff --git a/introspect/ws/server_lifecycle_test.go b/introspect/ws/server_lifecycle_test.go index 88ef827dbc..7fdbcad0a2 100644 --- a/introspect/ws/server_lifecycle_test.go +++ b/introspect/ws/server_lifecycle_test.go @@ -11,7 +11,7 @@ import ( ) func TestServerClose(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) // create 100 connections. @@ -35,7 +35,7 @@ func TestServerClose(t *testing.T) { } func TestServerHandlesClosedConns(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) conns := make([]*connWrapper, 100) diff --git a/introspect/ws/server_push_test.go b/introspect/ws/server_push_test.go index 61431cc4c1..f6745c5446 100644 --- a/introspect/ws/server_push_test.go +++ b/introspect/ws/server_push_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" ) type simpleEvent struct { @@ -19,7 +19,7 @@ type EventB simpleEvent type EventC simpleEvent func TestPushEvents(t *testing.T) { - server, mocki := createTestServer(t) + server, mocki, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -54,7 +54,7 @@ func TestPushEvents(t *testing.T) { } func TestPushStopPushEvents(t *testing.T) { - server, mocki := createTestServer(t) + server, mocki, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -111,7 +111,7 @@ func TestPushStopPushEvents(t *testing.T) { } func TestPushEventsIdempotent(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -135,3 +135,141 @@ func TestPushEventsIdempotent(t *testing.T) { require.EqualValues(t, 202, resp.Id) require.EqualValues(t, pb.CommandResponse_OK, resp.Result) } + +func TestPauseResume(t *testing.T) { + server, mocki, clk := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + mocki.On("FetchFullState").Return(&pb.State{}, nil) + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + conn.sendCommand(&pb.ClientCommand{Id: 202, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_STATE}) + conn.sendCommand(&pb.ClientCommand{Id: 203, Command: pb.ClientCommand_PUSH_PAUSE}) + + conn.consumeCommandResponse(201, pb.CommandResponse_OK) + conn.consumeCommandResponse(202, pb.CommandResponse_OK) + conn.consumeCommandResponse(203, pb.CommandResponse_OK) + + type tsmsg struct { + ts time.Time + msg *pb.ServerMessage + } + + var rcvd []tsmsg + triggerDrain, rcvdAll := make(chan struct{}), make(chan struct{}) + go func() { + defer close(rcvdAll) + <-triggerDrain + for i := 0; i < 9; i++ { + m := tsmsg{clk.Now(), conn.readNext()} + rcvd = append(rcvd, m) + } + }() + + // tick 5 seconds; this will generate 5 state messages. + clk.Add(time.Second) + clk.Add(time.Second) + clk.Add(time.Second) + clk.Add(time.Second) + clk.Add(time.Second) + + // send one event, tick once (state), send one event, tick once (state) + mocki.EventCh <- EventA{String: "hello", Number: 100} + clk.Add(time.Second) + mocki.EventCh <- EventB{String: "hello", Number: 100} + clk.Add(time.Second) + + // now resume, we should receive 9 messages all after now. + now := clk.Now() + conn.sendCommand(&pb.ClientCommand{Id: 204, Command: pb.ClientCommand_PUSH_RESUME}) + conn.consumeCommandResponse(204, pb.CommandResponse_OK) + close(triggerDrain) + + // we should be having 9 messages. + <-rcvdAll + + // all messages were received _after_ we resumed. + for _, m := range rcvd { + require.True(t, m.ts.Equal(now) || m.ts.After(now)) + } +} + +func TestPauseResumeMessagesDropped(t *testing.T) { + server, mocki, clk := createTestServer(t) + require.NoError(t, server.Start()) + defer server.Close() + + mocki.On("FetchFullState").Return(&pb.State{}, nil) + + conn := createConn(t, server) + defer conn.Close() + + conn.greet() + + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + conn.sendCommand(&pb.ClientCommand{Id: 202, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_STATE}) + + config := DefaultSessionConfig + config.RetentionPeriodMs = 2000 // 2 seconds retention period. + conn.sendCommand(&pb.ClientCommand{Id: 203, Command: pb.ClientCommand_UPDATE_CONFIG, Config: config}) + conn.sendCommand(&pb.ClientCommand{Id: 204, Command: pb.ClientCommand_PUSH_PAUSE}) + + conn.consumeCommandResponse(201, pb.CommandResponse_OK) + conn.consumeCommandResponse(202, pb.CommandResponse_OK) + conn.consumeCommandResponse(203, pb.CommandResponse_OK) + conn.consumeCommandResponse(204, pb.CommandResponse_OK) + + type tsmsg struct { + ts time.Time + msg *pb.ServerMessage + } + + var rcvd []tsmsg + triggerDrain, rcvdAll := make(chan struct{}), make(chan struct{}) + go func() { + defer close(rcvdAll) + <-triggerDrain + for i := 0; i < 5; i++ { + m := tsmsg{clk.Now(), conn.readNext()} + rcvd = append(rcvd, m) + } + }() + + // the event and the first few state messages will be discarded because they slid out of the retention window. + clk.Add(5 * time.Second) + mocki.EventCh <- EventA{String: "hello", Number: 100} + clk.Add(5 * time.Second) + + // send one event, tick once (state), send one event, tick once (state) + mocki.EventCh <- EventB{String: "hello", Number: 100} + mocki.EventCh <- EventB{String: "hello", Number: 100} + + // now resume, we should receive 9 messages all after now. + now := clk.Now() + conn.sendCommand(&pb.ClientCommand{Id: 205, Command: pb.ClientCommand_PUSH_RESUME}) + conn.consumeCommandResponse(205, pb.CommandResponse_OK) + close(triggerDrain) + + // we should be having 5 messages. + <-rcvdAll + + // all messages were received _after_ we resumed. + for _, m := range rcvd { + require.True(t, m.ts.Equal(now) || m.ts.After(now)) + } + + // three state messages + two events of type EventB. + require.NotNil(t, rcvd[0].msg.Payload.(*pb.ServerMessage_State).State) + require.NotNil(t, rcvd[1].msg.Payload.(*pb.ServerMessage_State).State) + require.NotNil(t, rcvd[2].msg.Payload.(*pb.ServerMessage_State).State) + require.NotNil(t, rcvd[3].msg.Payload.(*pb.ServerMessage_Event).Event) + require.NotNil(t, rcvd[4].msg.Payload.(*pb.ServerMessage_Event).Event) + require.EqualValues(t, "EventB", rcvd[3].msg.Payload.(*pb.ServerMessage_Event).Event.Type.Name) + require.EqualValues(t, "EventB", rcvd[4].msg.Payload.(*pb.ServerMessage_Event).Event.Type.Name) +} diff --git a/introspect/ws/server_request_test.go b/introspect/ws/server_request_test.go index 27a7e63d25..3d8d4a856c 100644 --- a/introspect/ws/server_request_test.go +++ b/introspect/ws/server_request_test.go @@ -9,7 +9,7 @@ import ( ) func TestRequestState(t *testing.T) { - server, mocki := createTestServer(t) + server, mocki, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -27,7 +27,7 @@ func TestRequestState(t *testing.T) { } func TestRequestRuntime(t *testing.T) { - server, mocki := createTestServer(t) + server, mocki, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() @@ -45,7 +45,7 @@ func TestRequestRuntime(t *testing.T) { } func TestRequestEventsFails(t *testing.T) { - server, _ := createTestServer(t) + server, _, _ := createTestServer(t) require.NoError(t, server.Start()) defer server.Close() diff --git a/introspect/ws/session.go b/introspect/ws/session.go index ef86168e28..fee4a52762 100644 --- a/introspect/ws/session.go +++ b/introspect/ws/session.go @@ -113,7 +113,7 @@ func (s *session) control() { defer s.wg.Done() // dummy ticker that won't tick unless enabled. - pruneQTicker := time.NewTicker(2 * time.Second) + pruneQTicker := s.server.clock.Ticker(2 * time.Second) defer pruneQTicker.Stop() defer func() { if s.pushingState { @@ -130,7 +130,7 @@ func (s *session) control() { continue } if s.paused { - s.q = append(s.q, &qitem{time.Now(), msg}) + s.q = append(s.q, &qitem{s.server.clock.Now(), msg}) continue } s.queueWrite(msg) @@ -151,7 +151,7 @@ func (s *session) control() { continue } if s.paused { - s.q = append(s.q, &qitem{time.Now(), evt}) + s.q = append(s.q, &qitem{s.server.clock.Now(), evt}) continue } s.queueWrite(evt) From a1cc324d302f2133be54025a4447ddd1ef13cb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 15:42:02 +0100 Subject: [PATCH 28/32] minor fixes. --- introspect/ws/server.go | 27 +++++++++++++++----------- introspect/ws/server_lifecycle_test.go | 17 +++++++++++----- introspect/ws/server_push_test.go | 15 ++++++-------- introspect/ws/session.go | 8 +++++--- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/introspect/ws/server.go b/introspect/ws/server.go index 0d3dbfd098..201cd1377c 100644 --- a/introspect/ws/server.go +++ b/introspect/ws/server.go @@ -46,7 +46,7 @@ type Endpoint struct { sessionOpenedCh chan *sessionEvent sessionClosedCh chan *sessionEvent getSessionsCh chan chan []*introspection.Session - killSessionsCh chan struct{} + stopConnsCh chan chan struct{} evalForTest chan func() @@ -57,7 +57,7 @@ type Endpoint struct { connsWg sync.WaitGroup controlWg sync.WaitGroup - closeCh chan struct{} + closedCh chan struct{} isClosed bool } @@ -96,10 +96,10 @@ func NewEndpoint(introspector introspection.Introspector, config *EndpointConfig sessionOpenedCh: make(chan *sessionEvent), sessionClosedCh: make(chan *sessionEvent), - killSessionsCh: make(chan struct{}), + stopConnsCh: make(chan chan struct{}), getSessionsCh: make(chan chan []*introspection.Session), - closeCh: make(chan struct{}), + closedCh: make(chan struct{}), } if srv.clock == nil { @@ -157,12 +157,14 @@ func (e *Endpoint) Close() error { return nil } - close(e.killSessionsCh) + ch := make(chan struct{}) + e.stopConnsCh <- ch + <-ch // wait for all connections to be dead. e.connsWg.Wait() - close(e.closeCh) + close(e.closedCh) // Close the server, which in turn closes all listeners. if err := e.server.Close(); err != nil { @@ -208,14 +210,14 @@ func (e *Endpoint) wsUpgrader() http.HandlerFunc { done := make(chan struct{}, 1) select { case e.sessionOpenedCh <- &sessionEvent{newSession(e, wsconn), done}: - case <-e.closeCh: + case <-e.closedCh: _ = wsconn.Close() return } select { case <-done: - case <-e.closeCh: + case <-e.closedCh: _ = wsconn.Close() return } @@ -238,7 +240,7 @@ func (e *Endpoint) worker() { select { case e.sessionClosedCh <- &sessionEvent{session, rq.doneCh}: - case <-e.closeCh: + case <-e.closedCh: return } }() @@ -272,12 +274,15 @@ func (e *Endpoint) worker() { } ch <- sessions - case <-e.killSessionsCh: + case ch := <-e.stopConnsCh: + // accept no more connections. + e.sessionOpenedCh = nil for sess := range e.sessions { sess.kill() } + close(ch) - case <-e.closeCh: + case <-e.closedCh: return } } diff --git a/introspect/ws/server_lifecycle_test.go b/introspect/ws/server_lifecycle_test.go index 7fdbcad0a2..bcea11080a 100644 --- a/introspect/ws/server_lifecycle_test.go +++ b/introspect/ws/server_lifecycle_test.go @@ -12,7 +12,8 @@ import ( func TestServerClose(t *testing.T) { server, _, _ := createTestServer(t) - require.NoError(t, server.Start()) + err := server.Start() + require.NoError(t, err) // create 100 connections. var wg sync.WaitGroup @@ -29,25 +30,31 @@ func TestServerClose(t *testing.T) { conns[i] = conn } - err := server.Close() + err = server.Close() require.NoError(t, err) wg.Wait() } func TestServerHandlesClosedConns(t *testing.T) { server, _, _ := createTestServer(t) + defer server.Close() + require.NoError(t, server.Start()) - conns := make([]*connWrapper, 100) + conns := make([]*connWrapper, 50) for i := range conns { conn := createConn(t, server) conns[i] = conn } - require.Len(t, server.Sessions(), 100) + require.Eventually(t, func() bool { return len(server.Sessions()) == 50 }, 2*time.Second, 100*time.Millisecond) err := conns[0].Close() require.NoError(t, err) - require.Eventually(t, func() bool { return len(server.Sessions()) == 99 }, 2*time.Second, 100*time.Millisecond) + require.Eventually(t, func() bool { return len(server.Sessions()) == 49 }, 2*time.Second, 100*time.Millisecond) + + for _, c := range conns[1:] { + _ = c.Close() + } } diff --git a/introspect/ws/server_push_test.go b/introspect/ws/server_push_test.go index f6745c5446..4cd36167bb 100644 --- a/introspect/ws/server_push_test.go +++ b/introspect/ws/server_push_test.go @@ -94,6 +94,7 @@ func TestPushStopPushEvents(t *testing.T) { // these events will be missed. mocki.EventCh <- EventA{String: "hello", Number: 100} mocki.EventCh <- EventB{String: "hello", Number: 100} + time.Sleep(500 * time.Millisecond) // enable the pusher again conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) @@ -173,11 +174,7 @@ func TestPauseResume(t *testing.T) { }() // tick 5 seconds; this will generate 5 state messages. - clk.Add(time.Second) - clk.Add(time.Second) - clk.Add(time.Second) - clk.Add(time.Second) - clk.Add(time.Second) + clk.Add(5 * time.Second) // send one event, tick once (state), send one event, tick once (state) mocki.EventCh <- EventA{String: "hello", Number: 100} @@ -212,12 +209,12 @@ func TestPauseResumeMessagesDropped(t *testing.T) { conn.greet() - conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) - conn.sendCommand(&pb.ClientCommand{Id: 202, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_STATE}) - config := DefaultSessionConfig config.RetentionPeriodMs = 2000 // 2 seconds retention period. - conn.sendCommand(&pb.ClientCommand{Id: 203, Command: pb.ClientCommand_UPDATE_CONFIG, Config: config}) + + conn.sendCommand(&pb.ClientCommand{Id: 201, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_EVENTS}) + conn.sendCommand(&pb.ClientCommand{Id: 202, Command: pb.ClientCommand_PUSH_ENABLE, Source: pb.ClientCommand_STATE}) + conn.sendCommand(&pb.ClientCommand{Id: 203, Command: pb.ClientCommand_UPDATE_CONFIG, Config: &config}) conn.sendCommand(&pb.ClientCommand{Id: 204, Command: pb.ClientCommand_PUSH_PAUSE}) conn.consumeCommandResponse(201, pb.CommandResponse_OK) diff --git a/introspect/ws/session.go b/introspect/ws/session.go index fee4a52762..ac58575f7a 100644 --- a/introspect/ws/session.go +++ b/introspect/ws/session.go @@ -26,11 +26,12 @@ var handlers = map[pb.ClientCommand_Command]func(*session, *pb.ClientCommand) *p var ( MaxRetentionPeriod = 120 * time.Second MinStateSnapshotInterval = 500 * time.Millisecond + PruneRetentionInterval = 2 * time.Second WriteTimeout = 5 * time.Second ConnBufferSize = 1 << 8 - DefaultSessionConfig = &pb.Configuration{ + DefaultSessionConfig = pb.Configuration{ RetentionPeriodMs: uint64(MaxRetentionPeriod / time.Millisecond), StateSnapshotIntervalMs: uint64(time.Second / time.Millisecond), } @@ -66,10 +67,11 @@ type session struct { } func newSession(sv *Endpoint, wsconn *websocket.Conn) *session { + cfgcpy := DefaultSessionConfig ch := &session{ server: sv, wsconn: wsconn, - config: DefaultSessionConfig, + config: &cfgcpy, stateTicker: new(clock.Ticker), writeCh: make(chan []byte, ConnBufferSize), @@ -113,7 +115,7 @@ func (s *session) control() { defer s.wg.Done() // dummy ticker that won't tick unless enabled. - pruneQTicker := s.server.clock.Ticker(2 * time.Second) + pruneQTicker := s.server.clock.Ticker(PruneRetentionInterval) defer pruneQTicker.Stop() defer func() { if s.pushingState { From 45f3dd81f781782edcba227e1c7926173eefd7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 15:48:02 +0100 Subject: [PATCH 29/32] fix import nits. --- introspect/default_inspector_test.go | 19 ++++++++++--------- introspect/event_manager.go | 2 +- introspect/event_manager_test.go | 2 +- introspect/mock_inspector.go | 2 +- introspect/ws/server_common_test.go | 9 +++++---- introspect/ws/server_config_test.go | 4 ++-- introspect/ws/server_hello_test.go | 4 ++-- introspect/ws/server_integration_test.go | 3 +-- introspect/ws/server_push_test.go | 4 ++-- introspect/ws/server_request_test.go | 4 ++-- 10 files changed, 27 insertions(+), 26 deletions(-) diff --git a/introspect/default_inspector_test.go b/introspect/default_inspector_test.go index 15d7b14802..5260737771 100644 --- a/introspect/default_inspector_test.go +++ b/introspect/default_inspector_test.go @@ -5,12 +5,13 @@ import ( "testing" "time" - "github.com/libp2p/go-libp2p" - introspection_pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peerstore" "github.com/libp2p/go-libp2p-core/protocol" + + "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p/introspect" "github.com/stretchr/testify/require" @@ -68,8 +69,8 @@ func TestConnsAndStreamIntrospect(t *testing.T) { require.Len(t, conns, 1) require.NotEmpty(t, conns[0].Id) require.Equal(t, h2.ID().String(), conns[0].PeerId) - require.Equal(t, introspection_pb.Status_ACTIVE, conns[0].Status) - require.Equal(t, introspection_pb.Role_INITIATOR, conns[0].Role) + require.Equal(t, pb.Status_ACTIVE, conns[0].Status) + require.Equal(t, pb.Role_INITIATOR, conns[0].Role) require.Equal(t, h1.Network().Conns()[0].LocalMultiaddr().String(), conns[0].Endpoints.SrcMultiaddr) require.Equal(t, h1.Network().Conns()[0].RemoteMultiaddr().String(), conns[0].Endpoints.DstMultiaddr) @@ -79,7 +80,7 @@ func TestConnsAndStreamIntrospect(t *testing.T) { require.NoError(t, err) // map stream to protocols - protos := make(map[string]*introspection_pb.Stream) + protos := make(map[string]*pb.Stream) for _, s := range streams { protos[s.Protocol] = s } @@ -88,8 +89,8 @@ func TestConnsAndStreamIntrospect(t *testing.T) { stream1 := protos["1"] require.NotEmpty(t, stream1) require.Equal(t, "1", stream1.Protocol) - require.Equal(t, introspection_pb.Role_INITIATOR, stream1.Role) - require.Equal(t, introspection_pb.Status_ACTIVE, stream1.Status) + require.Equal(t, pb.Role_INITIATOR, stream1.Role) + require.Equal(t, pb.Status_ACTIVE, stream1.Status) require.NotEmpty(t, stream1.Id) require.NotNil(t, stream1.Traffic) require.NotNil(t, stream1.Traffic.TrafficIn) @@ -99,8 +100,8 @@ func TestConnsAndStreamIntrospect(t *testing.T) { stream2 := protos["2"] require.NotEmpty(t, stream2) require.Equal(t, "2", stream2.Protocol) - require.Equal(t, introspection_pb.Role_INITIATOR, stream2.Role) - require.Equal(t, introspection_pb.Status_ACTIVE, stream2.Status) + require.Equal(t, pb.Role_INITIATOR, stream2.Role) + require.Equal(t, pb.Status_ACTIVE, stream2.Status) require.NotEmpty(t, stream2.Id) require.NotEqual(t, stream2.Id, stream1.Id) diff --git a/introspect/event_manager.go b/introspect/event_manager.go index 3318c38691..03aadcf3c6 100644 --- a/introspect/event_manager.go +++ b/introspect/event_manager.go @@ -11,7 +11,7 @@ import ( "github.com/ipfs/go-log/v2" "github.com/libp2p/go-libp2p-core/event" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/peer" "github.com/multiformats/go-multiaddr" diff --git a/introspect/event_manager_test.go b/introspect/event_manager_test.go index 3878cb35bc..041a8569a0 100644 --- a/introspect/event_manager_test.go +++ b/introspect/event_manager_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/libp2p/go-libp2p-core/event" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" "github.com/libp2p/go-libp2p-core/peer" ) diff --git a/introspect/mock_inspector.go b/introspect/mock_inspector.go index ab84bbfbdf..bbd7a0a371 100644 --- a/introspect/mock_inspector.go +++ b/introspect/mock_inspector.go @@ -4,7 +4,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/libp2p/go-libp2p-core/introspection" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/libp2p/go-libp2p-core/introspection/pb" ) type MockIntrospector struct { diff --git a/introspect/ws/server_common_test.go b/introspect/ws/server_common_test.go index 1b50ef3f58..1d4bddbecc 100644 --- a/introspect/ws/server_common_test.go +++ b/introspect/ws/server_common_test.go @@ -6,13 +6,14 @@ import ( "hash/fnv" "testing" + "github.com/libp2p/go-libp2p-core/introspection" + "github.com/libp2p/go-libp2p-core/introspection/pb" + + "github.com/libp2p/go-libp2p/introspect" + "github.com/benbjohnson/clock" "github.com/gorilla/websocket" "github.com/stretchr/testify/require" - - "github.com/libp2p/go-libp2p-core/introspection" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" - "github.com/libp2p/go-libp2p/introspect" ) func createTestServer(t *testing.T) (*Endpoint, *introspect.MockIntrospector, *clock.Mock) { diff --git a/introspect/ws/server_config_test.go b/introspect/ws/server_config_test.go index 344c0ad828..5c4c1f1b89 100644 --- a/introspect/ws/server_config_test.go +++ b/introspect/ws/server_config_test.go @@ -3,9 +3,9 @@ package ws import ( "testing" - "github.com/stretchr/testify/require" + "github.com/libp2p/go-libp2p-core/introspection/pb" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/stretchr/testify/require" ) func TestValidConfiguration(t *testing.T) { diff --git a/introspect/ws/server_hello_test.go b/introspect/ws/server_hello_test.go index 388dbd9092..12a3b21ed0 100644 --- a/introspect/ws/server_hello_test.go +++ b/introspect/ws/server_hello_test.go @@ -3,9 +3,9 @@ package ws import ( "testing" - "github.com/stretchr/testify/require" + "github.com/libp2p/go-libp2p-core/introspection/pb" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/stretchr/testify/require" ) func TestStartSession(t *testing.T) { diff --git a/introspect/ws/server_integration_test.go b/introspect/ws/server_integration_test.go index b6e6cf8d1e..bc00c0b5e8 100644 --- a/introspect/ws/server_integration_test.go +++ b/introspect/ws/server_integration_test.go @@ -13,11 +13,10 @@ import ( "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p/introspect" "github.com/stretchr/testify/require" - - "github.com/libp2p/go-libp2p" ) var ( diff --git a/introspect/ws/server_push_test.go b/introspect/ws/server_push_test.go index 4cd36167bb..724f9acf20 100644 --- a/introspect/ws/server_push_test.go +++ b/introspect/ws/server_push_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/libp2p/go-libp2p-core/introspection/pb" + + "github.com/stretchr/testify/require" ) type simpleEvent struct { diff --git a/introspect/ws/server_request_test.go b/introspect/ws/server_request_test.go index 3d8d4a856c..3b72acfe8d 100644 --- a/introspect/ws/server_request_test.go +++ b/introspect/ws/server_request_test.go @@ -3,9 +3,9 @@ package ws import ( "testing" - "github.com/stretchr/testify/require" + "github.com/libp2p/go-libp2p-core/introspection/pb" - pb "github.com/libp2p/go-libp2p-core/introspection/pb" + "github.com/stretchr/testify/require" ) func TestRequestState(t *testing.T) { From 762d2a9d9378602be36fbd13386089d8b2c27d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 16:13:33 +0100 Subject: [PATCH 30/32] nits. --- config/config.go | 2 +- options.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index cca27d0214..634384e12e 100644 --- a/config/config.go +++ b/config/config.go @@ -4,12 +4,12 @@ import ( "context" "crypto/rand" "fmt" - "github.com/libp2p/go-libp2p-core/introspection" "time" "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/host" + "github.com/libp2p/go-libp2p-core/introspection" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" diff --git a/options.go b/options.go index 414e6d66d2..8954af7b35 100644 --- a/options.go +++ b/options.go @@ -202,7 +202,7 @@ func ConnectionManager(connman connmgr.ConnManager) Option { // Example: // // import ( -// "github.com/libp2p/go-libp2p/introspect" +// "github.com/libp2p/go-libp2p/introspect" // "github.com/libp2p/go-libp2p/introspect/ws" // ) // From 29a83a148c86c4a10f3c83a767958ed02d5e5f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 18:40:21 +0100 Subject: [PATCH 31/32] remove unused evalForTest mechanism. --- introspect/ws/server.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/introspect/ws/server.go b/introspect/ws/server.go index 201cd1377c..532aa62f77 100644 --- a/introspect/ws/server.go +++ b/introspect/ws/server.go @@ -48,8 +48,6 @@ type Endpoint struct { getSessionsCh chan chan []*introspection.Session stopConnsCh chan chan struct{} - evalForTest chan func() - // state managed by locking lk sync.RWMutex listeners []net.Listener @@ -91,8 +89,7 @@ func NewEndpoint(introspector introspection.Introspector, config *EndpointConfig config: config, clock: config.Clock, - sessions: make(map[*session]struct{}, 16), - evalForTest: make(chan func()), + sessions: make(map[*session]struct{}, 16), sessionOpenedCh: make(chan *sessionEvent), sessionClosedCh: make(chan *sessionEvent), @@ -264,9 +261,6 @@ func (e *Endpoint) worker() { logger.Warnf("error while broadcasting event; err: %e", err) } - case fnc := <-e.evalForTest: - fnc() - case ch := <-e.getSessionsCh: sessions := make([]*introspection.Session, 0, len(e.sessions)) for sess := range e.sessions { From 09b4f33b62ab19af93476cfa5fe2c933acda0266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 5 Jun 2020 18:40:46 +0100 Subject: [PATCH 32/32] capture a multierror on close. --- go.mod | 1 + go.sum | 4 ++++ introspect/default_inspector.go | 7 +++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 21a2dd81d3..b78f31bcd9 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/benbjohnson/clock v1.0.2 github.com/gogo/protobuf v1.3.1 github.com/gorilla/websocket v1.4.2 + github.com/hashicorp/go-multierror v1.1.0 github.com/ipfs/go-cid v0.0.6 github.com/ipfs/go-detect-race v0.0.1 github.com/ipfs/go-ipfs-util v0.0.1 diff --git a/go.sum b/go.sum index 08dcbfcacd..623a9a31ef 100644 --- a/go.sum +++ b/go.sum @@ -116,6 +116,10 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= diff --git a/introspect/default_inspector.go b/introspect/default_inspector.go index 36201ee57d..6aedd474b7 100644 --- a/introspect/default_inspector.go +++ b/introspect/default_inspector.go @@ -16,6 +16,8 @@ import ( "github.com/libp2p/go-eventbus" "github.com/multiformats/go-multiaddr" + + "github.com/hashicorp/go-multierror" ) var _ introspection.Introspector = (*DefaultIntrospector)(nil) @@ -55,14 +57,15 @@ func NewDefaultIntrospector(host host.Host, reporter metrics.Reporter) (introspe } func (d *DefaultIntrospector) Close() error { + var err *multierror.Error if err := d.wsub.Close(); err != nil { - return fmt.Errorf("failed while trying to close wildcard eventbus subscription: %w", err) + err = multierror.Append(err, fmt.Errorf("failed while trying to close wildcard eventbus subscription: %w", err)) } close(d.closeCh) d.closeWg.Wait() - return nil + return err.ErrorOrNil() } func (d *DefaultIntrospector) FetchRuntime() (*pb.Runtime, error) {