Skip to content

Commit

Permalink
INS-2197: removed BehindNat configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
krestkrest committed Apr 1, 2019
1 parent c979287 commit 74f0e47
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local insolar_params = params.insolar;
"transport": {
"protocol": "TCP",
"address": "0.0.0.0:" + insolar_params.tcp_transport_port,
"behindnat": false
},
"bootstraphosts": [],
"isrelay": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ local utils = params.utils;
"distributiontransport": {
"protocol": "TCP",
"address": "0.0.0.0:58091",
"behindnat": false
},
"pulsedistributor": {
"bootstraphosts": [
Expand Down
1 change: 0 additions & 1 deletion ci/local-dev/manifests/old_configs/bootstrap-ss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ data:
transport:
protocol: TCP
address: 0.0.0.0:7900
behindnat: false
bootstraphosts: []
isrelay: false
infinitybootstrap: false
Expand Down
1 change: 0 additions & 1 deletion ci/local-dev/manifests/old_configs/pulsar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ data:
distributiontransport:
protocol: TCP
address: 0.0.0.0:58091
behindnat: false
pulsedistributor:
bootstraphosts:
- seed-0.bootstrap:7900
Expand Down
5 changes: 1 addition & 4 deletions configuration/hostnetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ type Transport struct {
Protocol string
// Address to listen
Address string
// if true transport will use network traversal technique(like STUN) to get PublicAddress
BehindNAT bool
// if not empty - this should be public address of instance (to connect from the "other" side to)
// conflicts in BehindNAT
FixedPublicAddress string
}

Expand All @@ -44,7 +41,7 @@ type HostNetwork struct {
// NewHostNetwork creates new default HostNetwork configuration
func NewHostNetwork() HostNetwork {
// IP address should not be 0.0.0.0!!!
transport := Transport{Protocol: "TCP", Address: "127.0.0.1:0", BehindNAT: false}
transport := Transport{Protocol: "TCP", Address: "127.0.0.1:0"}

return HostNetwork{
Transport: transport,
Expand Down
5 changes: 2 additions & 3 deletions configuration/pulsar.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ func NewPulsar() Pulsar {

NumberDelta: 10,
DistributionTransport: Transport{
Protocol: "TCP",
Address: "0.0.0.0:18091",
BehindNAT: false,
Protocol: "TCP",
Address: "0.0.0.0:18091",
},
PulseDistributor: PulseDistributor{
BootstrapHosts: []string{"localhost:53837"},
Expand Down
1 change: 0 additions & 1 deletion configuration/testdata/invalid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ invalid:
transport:
protocol: TCP
address: 0.0.0.0:0
behindnat: true
bootstraphosts: []
isrelay: false
code:
Expand Down
1 change: 0 additions & 1 deletion docker/insolard.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ host:
transport:
protocol: TCP
address: ""
behindnat: false
isrelay: false
infinitybootstrap: false
mintimeout: 1
Expand Down
1 change: 0 additions & 1 deletion network/hostnetwork/transport_consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ func NewConsensusNetwork(address, nodeID string, shortID insolar.ShortNodeID) (n
conf := configuration.Transport{}
conf.Address = address
conf.Protocol = "PURE_UDP"
conf.BehindNAT = false

tp, err := transport.NewTransport(conf, relay.NewProxy())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion network/hostnetwork/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func newMockResolver() *MockResolver {

func mockConfiguration(address string) configuration.Configuration {
result := configuration.Configuration{}
result.Host.Transport = configuration.Transport{Protocol: "TCP", Address: address, BehindNAT: false}
result.Host.Transport = configuration.Transport{Protocol: "TCP", Address: address}
return result
}

Expand Down
5 changes: 2 additions & 3 deletions network/servicenetwork/integr_pulsar.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ type TestPulsar interface {

func NewTestPulsar(pulseTimeMs, requestsTimeoutMs, pulseDelta int32) (TestPulsar, error) {
transportCfg := configuration.Transport{
Protocol: "TCP",
Address: "127.0.0.1:0",
BehindNAT: false,
Protocol: "TCP",
Address: "127.0.0.1:0",
}
tp, err := transport.NewTransport(transportCfg, relay.NewProxy())
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions network/transport/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,37 +191,37 @@ func (t *transportSuite) TestSendBigPacket() {
// }

// func TestUDPTransport(t *testing.T) {
// cfg1 := configuration.Transport{Protocol: "PURE_UDP", Address: "127.0.0.1:17014", BehindNAT: false}
// cfg2 := configuration.Transport{Protocol: "PURE_UDP", Address: "127.0.0.1:17015", BehindNAT: false}
// cfg1 := configuration.Transport{Protocol: "PURE_UDP", Address: "127.0.0.1:17014"}
// cfg2 := configuration.Transport{Protocol: "PURE_UDP", Address: "127.0.0.1:17015"}
//
// suite.Run(t, NewConsensusSuite(cfg1, cfg2))
// }

func TestTCPTransport(t *testing.T) {
cfg1 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17016", BehindNAT: false}
cfg2 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17017", BehindNAT: false}
cfg1 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17016"}
cfg2 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17017"}

suite.Run(t, NewSuite(cfg1, cfg2))
}

func TestQuicTransport(t *testing.T) {
t.Skip("QUIC internals racing atm. Skip until we want to use it in production")

cfg1 := configuration.Transport{Protocol: "QUIC", Address: "127.0.0.1:17018", BehindNAT: false}
cfg2 := configuration.Transport{Protocol: "QUIC", Address: "127.0.0.1:17019", BehindNAT: false}
cfg1 := configuration.Transport{Protocol: "QUIC", Address: "127.0.0.1:17018"}
cfg2 := configuration.Transport{Protocol: "QUIC", Address: "127.0.0.1:17019"}

suite.Run(t, NewSuite(cfg1, cfg2))
}

func Test_createResolver(t *testing.T) {
a := assert.New(t)

cfg1 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17018", BehindNAT: false, FixedPublicAddress: "192.168.0.1"}
cfg1 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17018", FixedPublicAddress: "192.168.0.1"}
r, err := createResolver(cfg1)
a.NoError(err)
a.IsType(resolver.NewFixedAddressResolver(""), r)

cfg3 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17018", BehindNAT: false, FixedPublicAddress: ""}
cfg3 := configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:17018", FixedPublicAddress: ""}
r, err = createResolver(cfg3)
a.NoError(err)
a.IsType(resolver.NewExactResolver(), r)
Expand Down
2 changes: 1 addition & 1 deletion pulsar/pulsar_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestPulsar_SendPulseToNode(t *testing.T) {
configuration.Pulsar{
ConnectionType: "tcp",
MainListenerAddress: ":1640",
DistributionTransport: configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:1890", BehindNAT: false},
DistributionTransport: configuration.Transport{Protocol: "TCP", Address: "127.0.0.1:1890"},
Neighbours: []configuration.PulsarNodeAddress{},
},
cryptoService,
Expand Down
1 change: 0 additions & 1 deletion scripts/insolard/pulsar_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pulsar:
distributiontransport:
protocol: TCP
address: 127.0.0.1:58091
behindnat: false
keyspath: "scripts/insolard/configs/bootstrap_keys.json"
log:
level: Debug
Expand Down

0 comments on commit 74f0e47

Please sign in to comment.