storj/pkg/kademlia/kademlia_test.go

449 lines
12 KiB
Go
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package kademlia
import (
"bytes"
"context"
"net"
"strconv"
2018-11-19 15:07:24 +00:00
"sync/atomic"
"testing"
"time"
"github.com/stretchr/testify/assert"
2019-01-29 06:51:07 +00:00
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"go.uber.org/zap/zaptest"
"google.golang.org/grpc"
"storj.io/storj/internal/testcontext"
"storj.io/storj/internal/testidentity"
"storj.io/storj/internal/testrand"
"storj.io/storj/internal/teststorj"
"storj.io/storj/pkg/identity"
2019-04-22 10:07:50 +01:00
"storj.io/storj/pkg/overlay"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/storj"
"storj.io/storj/pkg/transport"
2019-01-29 06:51:07 +00:00
"storj.io/storj/storage/teststore"
)
const (
defaultAlpha = 5
)
func TestNewKademlia(t *testing.T) {
ctx := testcontext.New(t)
defer ctx.Cleanup()
cases := []struct {
id *identity.FullIdentity
bn []pb.Node
addr string
expectedErr error
}{
{
id: func() *identity.FullIdentity {
id, err := testidentity.NewTestIdentity(ctx)
2019-01-29 06:51:07 +00:00
require.NoError(t, err)
return id
}(),
bn: []pb.Node{{Id: teststorj.NodeIDFromString("foo")}},
addr: "127.0.0.1:8080",
},
{
2019-01-30 20:47:21 +00:00
id: func() *identity.FullIdentity {
id, err := testidentity.NewTestIdentity(ctx)
2019-01-29 06:51:07 +00:00
require.NoError(t, err)
return id
}(),
bn: []pb.Node{{Id: teststorj.NodeIDFromString("foo")}},
addr: "127.0.0.1:8080",
},
}
for i, v := range cases {
kad, err := newKademlia(ctx, zaptest.NewLogger(t), pb.NodeType_STORAGE, v.bn, v.addr, pb.NodeOperator{}, v.id, ctx.Dir(strconv.Itoa(i)), defaultAlpha)
2019-01-29 06:51:07 +00:00
require.NoError(t, err)
assert.Equal(t, v.expectedErr, err)
assert.Equal(t, kad.bootstrapNodes, v.bn)
2019-01-18 15:00:56 +00:00
assert.NotNil(t, kad.dialer)
assert.NotNil(t, kad.routingTable)
assert.NoError(t, kad.Close())
}
}
func TestPeerDiscovery(t *testing.T) {
ctx := testcontext.New(t)
defer ctx.Cleanup()
// make new identity
bootServer, mockBootServer, bootID, bootAddress := startTestNodeServer(ctx)
defer bootServer.GracefulStop()
testServer, _, testID, testAddress := startTestNodeServer(ctx)
defer testServer.GracefulStop()
targetServer, _, targetID, targetAddress := startTestNodeServer(ctx)
defer targetServer.GracefulStop()
2019-04-22 10:07:50 +01:00
bootstrapNodes := []pb.Node{{Id: bootID.ID, Address: &pb.NodeAddress{Address: bootAddress}}}
operator := pb.NodeOperator{
2019-01-02 10:31:49 +00:00
Wallet: "OperatorWallet",
}
k, err := newKademlia(ctx, zaptest.NewLogger(t), pb.NodeType_STORAGE, bootstrapNodes, testAddress, operator, testID, ctx.Dir("test"), defaultAlpha)
require.NoError(t, err)
rt := k.routingTable
2019-04-22 10:07:50 +01:00
assert.Equal(t, rt.Local().Operator.Wallet, "OperatorWallet")
defer ctx.Check(k.Close)
cases := []struct {
target storj.NodeID
expected *pb.Node
expectedErr error
}{
{target: func() storj.NodeID {
2019-04-22 10:07:50 +01:00
mockBootServer.returnValue = []*pb.Node{{Id: targetID.ID, Address: &pb.NodeAddress{Address: targetAddress}}}
return targetID.ID
}(),
expected: &pb.Node{},
expectedErr: nil,
},
{target: bootID.ID,
expected: nil,
Testcoverage kademlia (#154) * Unit test covarege increased for kademlia pkg go style formatting added Removed DHT param from newTestKademlia method, added comments for Bucket methods that informs that these tests will need to be updated unnecessary comment deleted from newTestKademlia Adjust Segment Store to the updated interface (#160) * Adjust Segment Store to the updated interface * Move /pkg/storage/segment to /pkg/storage/segments * Fix overlay client tests * Revert changes in NewOverlayClient return value * Rename `rem` to `seg` * Implement Meta() captplanet (#159) * captplanet I kind of went overboard this weekend. The major goal of this changeset is to provide an environment for local development where all of the various services can be easily run together. Developing on Storj v3 should be as easy as running a setup command and a run command! To do this, this changeset introduces a new tool called captplanet, which combines the powers of the Overlay Cache, the PointerDB, the PieceStore, Kademlia, the Minio Gateway, etc. Running 40 farmers and a heavy client inside the same process forced a rethinking of the "services" that we had. To avoid confusion by reusing prior terms, this changeset introduces two new types: Providers and Responsibilities. I wanted to avoid as many merge conflicts as possible, so I left the existing Services and code for now, but if people like this route we can clean up the duplication. A Responsibility is a collection of gRPC methods and corresponding state. The following systems are examples of Responsibilities: * Kademlia * OverlayCache * PointerDB * StatDB * PieceStore * etc. A Provider is a collection of Responsibilities that share an Identity, such as: * The heavy client * The farmer * The gateway An Identity is a public/private key pair, a node id, etc. Farmers all need different Identities, so captplanet needs to support running multiple concurrent Providers with different Identities. Each Responsibility and Provider should allow for configuration of multiple copies on its own so creating Responsibilities and Providers use a new workflow. To make a Responsibility, one should create a "config" struct, such as: ``` type Config struct { RepairThreshold int `help:"If redundancy falls below this number of pieces, repair is triggered" default:"30"` SuccessThreshold int `help:"If redundancy is above this number then no additional uploads are needed" default:"40"` } ``` To use "config" structs, this changeset introduces another new library called 'cfgstruct', which allows for the configuration of arbitrary structs through flagsets, and thus through cobra and viper. cfgstruct relies on Go's "struct tags" feature to document help information and default values. Config structs can be configured via cfgstruct.Bind for binding the struct to a flagset. Because this configuration system makes setup and configuration easier *in general*, additional commands are provided that allow for easy standup of separate Providers. Please make sure to check out: * cmd/captplanet/farmer/main.go (a new farmer binary) * cmd/captplanet/hc/main.go (a new heavy client binary) * cmd/captplanet/gw/main.go (a new minio gateway binary) Usage: ``` $ go install -v storj.io/storj/cmd/captplanet $ captplanet setup $ captplanet run ``` Configuration is placed by default in `~/.storj/capt/` Other changes: * introduces new config structs for currently existing Responsibilities that conform to the new Responsibility interface. Please see the `pkg/*/config.go` files for examples. * integrates the PointerDB API key with other global configuration via flags, instead of through environment variables through viper like it's been doing. (ultimately this should also change to use the PointerDB config struct but this is an okay shortterm solution). * changes the Overlay cache to use a URL for database configuration instead of separate redis and bolt config settings. * stubs out some peer identity skeleton code (but not the meat). * Fixes the SegmentStore to use the overlay client and pointerdb clients instead of gRPC client code directly * Leaves a very clear spot where we need to tie the object to stream to segment store together. There's sort of a "golden spike" opportunity to connect all the train tracks together at the bottom of pkg/miniogw/config.go, labeled with a bunch of TODOs. Future stuff: * I now prefer this design over the original pkg/process.Service thing I had been pushing before (sorry!) * The experience of trying to have multiple farmers configurable concurrently led me to prefer config structs over global flags (I finally came around) or using viper directly. I think global flags are okay sometimes but in general going forward we should try and get all relevant config into config structs. * If you all like this direction, I think we can go delete my old Service interfaces and a bunch of flags and clean up a bunch of stuff. * If you don't like this direction, it's no sweat at all, and despite how much code there is here I'm not very tied to any of this! Considering a lot of this was written between midnight and 6 am, it might not be any good! * bind tests Add files for testing builds in docker (#161) * Add files for testing builds in docker * Make tests check for redis running before trying to start redis-server, which may not exist. * Clean redis server before any tests use it. * Add more debugging for travis * Explicitly requiring redis for travis pkg/provider: with pkg/provider merged, make a single heavy client binary, gateway binary, and deprecate old services (#165) * pkg/provider: with pkg/provider merged, make a single heavy client binary and deprecate old services * add setup to gw binary too * captplanet: output what addresses everything is listening on * revert peertls/io_util changes * define config flag across all commands * use trimsuffix fix docker makefile (#170) * fix makefile protos: update protobufs with go generate (#169) the import for timestamp and duration should use the path provided by a standard protocol buffer library installation Refactor List in PointerDB (#163) * Refactor List in Pointer DB * Fix pointerdb-client example * Fix issue in Path type related to empty paths * Test for the PointerDB service with some fixes * Fixed debug message in example: trancated --> more * GoDoc comments for unexported methods * TODO comment to check if Put is overwriting * Log warning if protobuf timestamp cannot be converted * TODO comment to make ListPageLimit configurable * Rename 'segment' package to 'segments' to reflect folder name Minio integration with Object store (#156) * initial WIP integration with Object store * List WIP * minio listobject function changes complete * Code review changes and work in progress for the mock objectstore unit testing cases * Warning fix redeclaration of err * Warning fix redeclaration of err * code review comments & unit testing inprogress * fix compilation bug * Fixed code review comments & added GetObject Mock test case * rearraged the mock test file and gateway storj test file in to the proper directory * added the missing file * code clean up * fix lint error on the mock generated code * modified per code review comments * added the PutObject mock test case * added the GetObjectInfo mock test case * added listobject mock test case * fixed package from storj to miniogw * resolved the gateway-storj.go initialization merge conflict update readme (#174) added assertion for unused errors (#152) merging this PR to avoid future issues updating github user to personal account (#171) Test coverage ranger (#168) * Fixed go panic for corner case * Initial test coverage for ranger pkg streamstore: add passthrough implementation (#176) this doesn't implement streamstore, this just allows us to try and get the june demo working again in the meantime StatDB (#144) * add statdb proto and example client * server logic * update readme * remove boltdb from service.go * sqlite3 * add statdb server executable file * create statdb node table if it does not exist already * get UpdateBatch working * update based on jt review * remove some commented lines * fix linting issues * reformat * apiKey -> APIKey * update statdb client apiKey->APIKey Update README.md Update README.md overlay: correct dockerfile db (#179) cmd/hc, cmd/gw, cmd/captplanet: simplify setup/run commands (#178) also allows much more customization of services within captain planet, such as reconfiguring the overlay service to use redis pkg/process: don't require json formatting (#177) Cleanup metadata across layers (#180) * Cleanup metadata across layers * Fix pointer db tests Kademlia Routing Table (#164) * adds comment * runs deps * creates boltdb kademlia routing table * protobuf updates * adds reverselist to mockkeyvaluestore interface * xor wip * xor wip * fixes xor sort * runs go fmt * fixes * goimports again * trying to fix travis tests * fixes mock tests Ranger refactoring (#158) * Fixed go panic for corner case * Cosmetic changes, and small error fixes miniogw: log all errors (#182) * miniogw: log all errors * tests added * doc comment to satisfy linter * fix test failure Jennifer added to CLA list * Temporary fix for storage/redis list method test
2018-08-02 19:36:57 +01:00
expectedErr: nil,
},
}
for _, v := range cases {
_, err := k.lookup(ctx, v.target)
assert.Equal(t, v.expectedErr, err)
}
}
func TestBootstrap(t *testing.T) {
ctx := testcontext.New(t)
defer ctx.Cleanup()
bn, s, clean := testNode(ctx, "1", t, []pb.Node{})
defer clean()
defer s.GracefulStop()
2019-04-22 10:07:50 +01:00
n1, s1, clean1 := testNode(ctx, "2", t, []pb.Node{bn.routingTable.self.Node})
defer clean1()
defer s1.GracefulStop()
err := n1.Bootstrap(ctx)
require.NoError(t, err)
2019-04-22 10:07:50 +01:00
n2, s2, clean2 := testNode(ctx, "3", t, []pb.Node{bn.routingTable.self.Node})
defer clean2()
defer s2.GracefulStop()
err = n2.Bootstrap(ctx)
require.NoError(t, err)
nodeIDs, err := n2.routingTable.nodeBucketDB.List(ctx, nil, 0)
require.NoError(t, err)
assert.Len(t, nodeIDs, 3)
}
func testNode(ctx *testcontext.Context, name string, t *testing.T, bn []pb.Node) (*Kademlia, *grpc.Server, func()) {
// new address
lis, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
// new config
// new identity
fid, err := testidentity.NewTestIdentity(ctx)
require.NoError(t, err)
// new kademlia
logger := zaptest.NewLogger(t)
k, err := newKademlia(ctx, logger, pb.NodeType_STORAGE, bn, lis.Addr().String(), pb.NodeOperator{}, fid, ctx.Dir(name), defaultAlpha)
require.NoError(t, err)
2019-03-22 20:06:57 +00:00
s := NewEndpoint(logger, k, k.routingTable)
// new ident opts
2019-04-08 19:15:19 +01:00
serverOptions, err := tlsopts.NewOptions(fid, tlsopts.Config{
2019-04-09 18:01:45 +01:00
PeerIDVersions: "*",
2019-04-08 19:15:19 +01:00
})
require.NoError(t, err)
identOpt := serverOptions.ServerOption()
grpcServer := grpc.NewServer(identOpt)
pb.RegisterNodesServer(grpcServer, s)
ctx.Go(func() error {
err := grpcServer.Serve(lis)
if err == grpc.ErrServerStopped {
err = nil
}
return err
})
return k, grpcServer, func() {
assert.NoError(t, k.Close())
}
}
func TestRefresh(t *testing.T) {
ctx := testcontext.New(t)
defer ctx.Cleanup()
k, s, clean := testNode(ctx, "refresh", t, []pb.Node{})
defer clean()
defer s.GracefulStop()
//turn back time for only bucket
rt := k.routingTable
now := time.Now().UTC()
2019-01-02 18:57:11 +00:00
bID := firstBucketID //always exists
err := rt.SetBucketTimestamp(ctx, bID[:], now.Add(-2*time.Hour))
require.NoError(t, err)
//refresh should call FindNode, updating the time
err = k.refresh(ctx, time.Minute)
require.NoError(t, err)
ts1, err := rt.GetBucketTimestamp(ctx, bID[:])
require.NoError(t, err)
assert.True(t, now.Add(-5*time.Minute).Before(ts1))
//refresh should not call FindNode, leaving the previous time
err = k.refresh(ctx, time.Minute)
require.NoError(t, err)
ts2, err := rt.GetBucketTimestamp(ctx, bID[:])
require.NoError(t, err)
assert.True(t, ts1.Equal(ts2))
s.GracefulStop()
}
func TestFindNear(t *testing.T) {
ctx := testcontext.New(t)
defer ctx.Cleanup()
// make new identity
fid, err := testidentity.NewTestIdentity(ctx)
require.NoError(t, err)
fid2, err := testidentity.NewTestIdentity(ctx)
require.NoError(t, err)
assert.NotEqual(t, fid.ID, fid2.ID)
//start kademlia
lis, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
srv, _ := newTestServer(ctx, []*pb.Node{{Id: teststorj.NodeIDFromString("foo")}})
defer srv.Stop()
ctx.Go(func() error {
err := srv.Serve(lis)
if err == grpc.ErrServerStopped {
err = nil
}
return err
})
bootstrap := []pb.Node{{Id: fid2.ID, Address: &pb.NodeAddress{Address: lis.Addr().String()}}}
k, err := newKademlia(ctx, zaptest.NewLogger(t), pb.NodeType_STORAGE, bootstrap,
2019-04-22 10:07:50 +01:00
lis.Addr().String(), pb.NodeOperator{}, fid, ctx.Dir("kademlia"), defaultAlpha)
require.NoError(t, err)
defer ctx.Check(k.Close)
// add nodes
nodes := []*pb.Node{}
newNode := func(id string, bw, disk int64) pb.Node {
nodeID := teststorj.NodeIDFromString(id)
2019-04-22 10:07:50 +01:00
n := &pb.Node{Id: nodeID}
nodes = append(nodes, n)
err = k.routingTable.ConnectionSuccess(ctx, n)
require.NoError(t, err)
return *n
}
nodeIDA := newNode("AAAAA", 1, 4)
2019-04-22 10:07:50 +01:00
newNode("BBBBB", 2, 3)
newNode("CCCCC", 3, 2)
newNode("DDDDD", 4, 1)
require.Len(t, nodes, 4)
cases := []struct {
testID string
target storj.NodeID
limit int
restrictions []pb.Restriction
expected []*pb.Node
}{
{testID: "three", target: nodeIDA.Id, limit: 4, expected: nodes, restrictions: []pb.Restriction{}},
}
for _, c := range cases {
testCase := c
t.Run(testCase.testID, func(t *testing.T) {
ns, err := k.FindNear(ctx, testCase.target, testCase.limit)
require.NoError(t, err)
assert.Equal(t, len(testCase.expected), len(ns))
for _, e := range testCase.expected {
found := false
for _, n := range ns {
if e.Id == n.Id {
found = true
}
}
assert.True(t, found, e.String())
}
})
}
}
func startTestNodeServer(ctx *testcontext.Context) (*grpc.Server, *mockNodesServer, *identity.FullIdentity, string) {
lis, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return nil, nil, nil, ""
}
ca, err := testidentity.NewTestCA(ctx)
if err != nil {
return nil, nil, nil, ""
}
identity, err := ca.NewIdentity()
if err != nil {
return nil, nil, nil, ""
}
serverOptions, err := tlsopts.NewOptions(identity, tlsopts.Config{})
if err != nil {
return nil, nil, nil, ""
}
identOpt := serverOptions.ServerOption()
grpcServer := grpc.NewServer(identOpt)
2018-11-19 15:07:24 +00:00
mn := &mockNodesServer{queryCalled: 0}
pb.RegisterNodesServer(grpcServer, mn)
ctx.Go(func() error {
err := grpcServer.Serve(lis)
if err == grpc.ErrServerStopped {
err = nil
}
return err
})
return grpcServer, mn, identity, lis.Addr().String()
}
2018-11-19 15:07:24 +00:00
func newTestServer(ctx *testcontext.Context, nn []*pb.Node) (*grpc.Server, *mockNodesServer) {
ca, err := testidentity.NewTestCA(ctx)
2018-11-19 15:07:24 +00:00
if err != nil {
return nil, nil
}
identity, err := ca.NewIdentity()
if err != nil {
return nil, nil
}
serverOptions, err := tlsopts.NewOptions(identity, tlsopts.Config{})
2018-11-19 15:07:24 +00:00
if err != nil {
return nil, nil
}
identOpt := serverOptions.ServerOption()
2018-11-19 15:07:24 +00:00
grpcServer := grpc.NewServer(identOpt)
mn := &mockNodesServer{queryCalled: 0}
pb.RegisterNodesServer(grpcServer, mn)
return grpcServer, mn
}
// TestRandomIds makes sure finds a random node ID is within a range (start..end]
func TestRandomIds(t *testing.T) {
for x := 0; x < 1000; x++ {
var start, end bucketID
// many valid options
start = testrand.NodeID()
end = testrand.NodeID()
if bytes.Compare(start[:], end[:]) > 0 {
start, end = end, start
}
id, err := randomIDInRange(start, end)
require.NoError(t, err, "Unexpected err in randomIDInRange")
assert.True(t, bytes.Compare(id[:], start[:]) > 0, "Random id was less than starting id")
assert.True(t, bytes.Compare(id[:], end[:]) <= 0, "Random id was greater than end id")
//invalid range
_, err = randomIDInRange(end, start)
assert.Error(t, err, "Missing expected err in invalid randomIDInRange")
//no valid options
end = start
_, err = randomIDInRange(start, end)
assert.Error(t, err, "Missing expected err in empty randomIDInRange")
// one valid option
if start[31] == 255 {
start[31] = 254
} else {
end[31] = start[31] + 1
}
id, err = randomIDInRange(start, end)
require.NoError(t, err, "Unexpected err in randomIDInRange")
assert.True(t, bytes.Equal(id[:], end[:]), "Not-so-random id was incorrect")
}
}
2018-11-19 15:07:24 +00:00
type mockNodesServer struct {
queryCalled int32
pingCalled int32
infoCalled int32
2018-11-19 15:07:24 +00:00
returnValue []*pb.Node
}
func (mn *mockNodesServer) Query(ctx context.Context, req *pb.QueryRequest) (*pb.QueryResponse, error) {
atomic.AddInt32(&mn.queryCalled, 1)
return &pb.QueryResponse{Response: mn.returnValue}, nil
}
func (mn *mockNodesServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error) {
atomic.AddInt32(&mn.pingCalled, 1)
return &pb.PingResponse{}, nil
}
2019-01-29 06:51:07 +00:00
func (mn *mockNodesServer) RequestInfo(ctx context.Context, req *pb.InfoRequest) (*pb.InfoResponse, error) {
atomic.AddInt32(&mn.infoCalled, 1)
return &pb.InfoResponse{}, nil
}
2019-01-29 06:51:07 +00:00
// newKademlia returns a newly configured Kademlia instance
func newKademlia(ctx context.Context, log *zap.Logger, nodeType pb.NodeType, bootstrapNodes []pb.Node, address string, operator pb.NodeOperator, identity *identity.FullIdentity, path string, alpha int) (*Kademlia, error) {
2019-04-22 10:07:50 +01:00
self := &overlay.NodeDossier{
Node: pb.Node{
Id: identity.ID,
Address: &pb.NodeAddress{Address: address},
},
2019-01-29 06:51:07 +00:00
Type: nodeType,
2019-04-22 10:07:50 +01:00
Operator: operator,
2019-01-29 06:51:07 +00:00
}
rt, err := NewRoutingTable(log, self, teststore.New(), teststore.New(), nil)
if err != nil {
return nil, err
}
2019-04-08 19:15:19 +01:00
tlsOptions, err := tlsopts.NewOptions(identity, tlsopts.Config{
2019-04-09 18:01:45 +01:00
PeerIDVersions: "*",
2019-04-08 19:15:19 +01:00
})
if err != nil {
return nil, err
2019-01-29 06:51:07 +00:00
}
Add Versioning Server (#1576) * Initial Webserver Draft for Version Controlling * Rename type to avoid confusion * Move Function Calls into Version Package * Fix Linting and Language Typos * Fix Linting and Spelling Mistakes * Include Copyright * Include Copyright * Adjust Version-Control Server to return list of Versions * Linting * Improve Request Handling and Readability * Add Configuration File Option Add Systemd Service file * Add Logging to File * Smaller Changes * Add Semantic Versioning and refuses outdated Software from Startup (#1612) * implements internal Semantic Version library * adds version logging + reporting to process * Advance SemVer struct for easier handling * Add Accepted Version Store * Fix Function * Restructure * Type Conversion * Handle Version String properly * Add Note about array index * Set temporary Default Version * Add Copyright * Adding Version to Dashboard * Adding Version Info Log * Renaming and adding CheckerProcess * Iteration Sync * Iteration V2 * linting * made LogAndReportVersion a go routine * Refactor to Go Routine * Add Context to Go Routine and allow Operation if Lookup to Control Server fails * Handle Unmarshal properly * Linting * Relocate Version Checks * Relocating Version Check and specified default Version for now * Linting Error Prevention * Refuse Startup on outdated Version * Add Startup Check Function * Straighten Logging * Dont force Shutdown if --dev flag is set * Create full Service/Peer Structure for ControlServer * Linting * Straighting Naming * Finish VersionControl Service Layout * Improve Error Handling * Change Listening Address * Move Checker Function * Remove VersionControl Peer * Linting * Linting * Create VersionClient Service * Renaming * Add Version Client to Peer Definitions * Linting and Renaming * Linting * Remove Transport Checks for now * Move to Client Side Flag * Remove check * Linting * Transport Client Version Intro * Adding Version Client to Transport Client * Add missing parameter * Adding Version Check, to set Allowed = true * Set Default to true, testing * Restructuring Code * Uplink Changes * Add more proper Defaults * Renaming of Version struct * Dont pass Service use Pointer * Set Defaults for Versioning Checks * Put HTTP Server in go routine * Add Versioncontrol to Storj-Sim * Testplanet Fixes * Linting * Add Error Handling and new Server Struct * Move Lock slightly * Reduce Race Potentials * Remove unnecessary files * Linting * Add Proper Transport Handling * small fixes * add fence for allowed check * Add Startup Version Check and Service Naming * make errormessage private * Add Comments about VersionedClient * Linting * Remove Checks that refuse outgoing connections * Remove release cmd * Add Release Script * Linting * Update to use correct Values * Move vars private and set minimum default versions for testing builds * Remove VersionedClient * Better Error Handling and naked return removal * Straighten the Regex and string conversion * Change Check to allows testplanet and storj-sim to run without the need to pass an LDFlag * Cosmetic Change to Dashboard * Cleanup Returns and remove commented code * Remove Version Check if no build options are passed in * Pass in Config Values instead of Pointers * Handle missed Error * Update Endpoint URL * Change Type of Release Flag * Add additional Logging * Remove Versions Logging of other Services * minor fixes Change-Id: I5cc04a410ea6b2008d14dffd63eb5f36dd348a8b
2019-04-03 20:13:39 +01:00
transportClient := transport.NewClient(tlsOptions, rt)
2019-01-29 06:51:07 +00:00
kadConfig := Config{
BootstrapBackoffMax: 10 * time.Second,
BootstrapBackoffBase: 1 * time.Second,
Alpha: alpha,
}
2019-04-22 10:07:50 +01:00
kad, err := NewService(log, transportClient, rt, kadConfig)
if err != nil {
return nil, err
}
kad.bootstrapNodes = bootstrapNodes
return kad, nil
2019-01-29 06:51:07 +00:00
}