Commit e03ecccd authored by tavit ohanian's avatar tavit ohanian

initial port

parent 32e1849c
Pipeline #760 passed with stages
in 1 minute and 48 seconds
stages:
- build
- test
variables:
BUILD_DIR: "/tmp/$CI_CONCURRENT_PROJECT_ID"
before_script:
- mkdir -p $BUILD_DIR/src
- cd $BUILD_DIR/src
- if [ -d $CI_PROJECT_DIR ]
- then
- echo "soft link $CI_PROJECT_DIR exists"
- else
- echo "creating soft link $CI_PROJECT_DIR"
- ln -s $CI_PROJECT_DIR
- fi
- cd $CI_PROJECT_DIR
build:
stage: build
tags:
- testing
script:
- echo $CI_JOB_STAGE
- go build
test:
stage: test
tags:
- testing
script:
- echo $CI_JOB_STAGE
- go test -cover
coverage: '/coverage: \d+.\d+% of statements/'
...@@ -6,9 +6,9 @@ import ( ...@@ -6,9 +6,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/libp2p/go-libp2p-core/discovery" "gitlab.dms3.io/p2p/go-p2p-core/discovery"
"github.com/libp2p/go-libp2p-core/peer" "gitlab.dms3.io/p2p/go-p2p-core/peer"
"github.com/libp2p/go-libp2p-peerstore/addr" "gitlab.dms3.io/p2p/go-p2p-peerstore/addr"
) )
// BackoffDiscovery is an implementation of discovery that caches peer data and attenuates repeated queries // BackoffDiscovery is an implementation of discovery that caches peer data and attenuates repeated queries
......
...@@ -6,10 +6,10 @@ import ( ...@@ -6,10 +6,10 @@ import (
"testing" "testing"
"time" "time"
bhost "github.com/libp2p/go-libp2p-blankhost" bhost "gitlab.dms3.io/p2p/go-p2p-blankhost"
"github.com/libp2p/go-libp2p-core/discovery" "gitlab.dms3.io/p2p/go-p2p-core/discovery"
"github.com/libp2p/go-libp2p-core/peer" "gitlab.dms3.io/p2p/go-p2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing" swarmt "gitlab.dms3.io/p2p/go-p2p-swarm/testing"
) )
type delayedDiscovery struct { type delayedDiscovery struct {
...@@ -243,7 +243,7 @@ func TestBackoffDiscoveryCacheCapacity(t *testing.T) { ...@@ -243,7 +243,7 @@ func TestBackoffDiscoveryCacheCapacity(t *testing.T) {
// Request peers with a lower limit this time using cache // Request peers with a lower limit this time using cache
// Here we are testing that the cache logic does not block when there are more peers known than the limit requested // Here we are testing that the cache logic does not block when there are more peers known than the limit requested
// See https://github.com/libp2p/go-libp2p-discovery/issues/67 // See https://gitlab.dms3.io/p2p/go-p2p-discovery/issues/67
assertNumPeersWithLimit(t, ctx, dCache, ns, n-1, n-1) assertNumPeersWithLimit(t, ctx, dCache, ns, n-1, n-1)
// Wait for next discovery so next request will bypass cache // Wait for next discovery so next request will bypass cache
......
...@@ -2,12 +2,13 @@ package discovery ...@@ -2,12 +2,13 @@ package discovery
import ( import (
"context" "context"
lru "github.com/hashicorp/golang-lru"
"sync" "sync"
"time" "time"
"github.com/libp2p/go-libp2p-core/host" lru "github.com/hashicorp/golang-lru"
"github.com/libp2p/go-libp2p-core/peer"
"gitlab.dms3.io/p2p/go-p2p-core/host"
"gitlab.dms3.io/p2p/go-p2p-core/peer"
) )
// BackoffConnector is a utility to connect to peers, but only if we have not recently tried connecting to them already // BackoffConnector is a utility to connect to peers, but only if we have not recently tried connecting to them already
......
...@@ -7,10 +7,10 @@ import ( ...@@ -7,10 +7,10 @@ import (
"testing" "testing"
"time" "time"
bhost "github.com/libp2p/go-libp2p-blankhost" bhost "gitlab.dms3.io/p2p/go-p2p-blankhost"
"github.com/libp2p/go-libp2p-core/host" "gitlab.dms3.io/p2p/go-p2p-core/host"
"github.com/libp2p/go-libp2p-core/peer" "gitlab.dms3.io/p2p/go-p2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing" swarmt "gitlab.dms3.io/p2p/go-p2p-swarm/testing"
) )
type maxDialHost struct { type maxDialHost struct {
......
...@@ -3,7 +3,7 @@ package discovery ...@@ -3,7 +3,7 @@ package discovery
import ( import (
"time" "time"
core "github.com/libp2p/go-libp2p-core/discovery" core "gitlab.dms3.io/p2p/go-p2p-core/discovery"
) )
// Deprecated: use skel.Advertiser instead. // Deprecated: use skel.Advertiser instead.
...@@ -15,18 +15,18 @@ type Discoverer = core.Discoverer ...@@ -15,18 +15,18 @@ type Discoverer = core.Discoverer
// Deprecated: use skel.Discovery instead. // Deprecated: use skel.Discovery instead.
type Discovery = core.Discovery type Discovery = core.Discovery
// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.Option instead. // Deprecated: use gitlab.dms3.io/p2p/go-p2p-core/discovery.Option instead.
type Option = core.Option type Option = core.Option
// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.Options instead. // Deprecated: use gitlab.dms3.io/p2p/go-p2p-core/discovery.Options instead.
type Options = core.Options type Options = core.Options
// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.TTL instead. // Deprecated: use gitlab.dms3.io/p2p/go-p2p-core/discovery.TTL instead.
func TTL(ttl time.Duration) core.Option { func TTL(ttl time.Duration) core.Option {
return core.TTL(ttl) return core.TTL(ttl)
} }
// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.Limit instead. // Deprecated: use gitlab.dms3.io/p2p/go-p2p-core/discovery.Limit instead.
func Limit(limit int) core.Option { func Limit(limit int) core.Option {
return core.Limit(limit) return core.Limit(limit)
} }
This diff is collapsed.
...@@ -5,9 +5,9 @@ import ( ...@@ -5,9 +5,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/libp2p/go-libp2p-core/discovery" "gitlab.dms3.io/p2p/go-p2p-core/discovery"
"github.com/libp2p/go-libp2p-core/host" "gitlab.dms3.io/p2p/go-p2p-core/host"
"github.com/libp2p/go-libp2p-core/peer" "gitlab.dms3.io/p2p/go-p2p-core/peer"
) )
type mockDiscoveryServer struct { type mockDiscoveryServer struct {
......
...@@ -2,13 +2,14 @@ package discovery ...@@ -2,13 +2,14 @@ package discovery
import ( import (
"context" "context"
"github.com/libp2p/go-libp2p-core/discovery"
"time" "time"
cid "github.com/ipfs/go-cid" "gitlab.dms3.io/p2p/go-p2p-core/discovery"
"github.com/libp2p/go-libp2p-core/peer" cid "gitlab.dms3.io/dms3/public/go-cid"
"github.com/libp2p/go-libp2p-core/routing"
"gitlab.dms3.io/p2p/go-p2p-core/peer"
"gitlab.dms3.io/p2p/go-p2p-core/routing"
mh "github.com/multiformats/go-multihash" mh "github.com/multiformats/go-multihash"
) )
......
...@@ -6,12 +6,12 @@ import ( ...@@ -6,12 +6,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/ipfs/go-cid" "gitlab.dms3.io/dms3/public/go-cid"
bhost "github.com/libp2p/go-libp2p-blankhost" bhost "gitlab.dms3.io/p2p/go-p2p-blankhost"
"github.com/libp2p/go-libp2p-core/discovery" "gitlab.dms3.io/p2p/go-p2p-core/discovery"
"github.com/libp2p/go-libp2p-core/host" "gitlab.dms3.io/p2p/go-p2p-core/host"
"github.com/libp2p/go-libp2p-core/peer" "gitlab.dms3.io/p2p/go-p2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing" swarmt "gitlab.dms3.io/p2p/go-p2p-swarm/testing"
) )
type mockRoutingTable struct { type mockRoutingTable struct {
......
...@@ -4,9 +4,9 @@ import ( ...@@ -4,9 +4,9 @@ import (
"context" "context"
"time" "time"
"github.com/libp2p/go-libp2p-core/peer" "gitlab.dms3.io/p2p/go-p2p-core/peer"
logging "github.com/ipfs/go-log" logging "gitlab.dms3.io/dms3/public/go-log"
) )
var log = logging.Logger("discovery") var log = logging.Logger("discovery")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment