[#607] config/example: Add all formats of node's network addresses

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-24 15:41:19 +03:00 committed by Leonard Lyubich
parent 6f861b6489
commit 81ddaeca16
4 changed files with 46 additions and 12 deletions

View file

@ -40,21 +40,51 @@ func TestNodeSection(t *testing.T) {
var fileConfigTest = func(c *config.Config) {
key := Key(c)
addr := BootstrapAddresses(c)
addrs := BootstrapAddresses(c)
attributes := Attributes(c)
relay := Relay(c)
wKey := Wallet(c)
var expectedAddr network.AddressGroup
err := expectedAddr.FromIterator(stringAddressGroup([]string{
"s01.neofs.devenv:8080",
"s02.neofs.devenv:8081",
}))
require.NoError(t, err)
expectedAddr := []struct {
str string
host string
tls bool
}{
{
str: "/dns4/localhost/tcp/8083/tls",
host: "localhost:8083",
tls: true,
},
{
str: "/dns4/s01.neofs.devenv/tcp/8080",
host: "s01.neofs.devenv:8080",
},
{
str: "/dns4/s02.neofs.devenv/tcp/8081",
host: "s02.neofs.devenv:8081",
},
{
str: "/ip4/127.0.0.1/tcp/8082",
host: "127.0.0.1:8082",
},
}
require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address())
require.Equal(t, expectedAddr, addr)
require.EqualValues(t, len(expectedAddr), addrs.Len())
ind := 0
addrs.IterateAddresses(func(addr network.Address) bool {
require.Equal(t, expectedAddr[ind].str, addr.String())
require.Equal(t, expectedAddr[ind].host, addr.HostAddr())
require.Equal(t, expectedAddr[ind].tls, addr.TLSEnabled())
ind++
return false
})
require.Equal(t, true, relay)
require.Len(t, attributes, 2)

View file

@ -11,7 +11,7 @@ NEOFS_NODE_KEY=./wallet.key
NEOFS_NODE_WALLET_PATH=./wallet.json
NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz
NEOFS_NODE_WALLET_PASSWORD=password
NEOFS_NODE_ADDRESSES=s01.neofs.devenv:8080 s02.neofs.devenv:8081
NEOFS_NODE_ADDRESSES=s01.neofs.devenv:8080 /dns4/s02.neofs.devenv/tcp/8081 grpc://127.0.0.1:8082 grpcs://localhost:8083
NEOFS_NODE_ATTRIBUTE_0=Price:11
NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU MSK
NEOFS_NODE_RELAY=true

View file

@ -19,7 +19,9 @@
},
"addresses": [
"s01.neofs.devenv:8080",
"s02.neofs.devenv:8081"
"/dns4/s02.neofs.devenv/tcp/8081",
"grpc://127.0.0.1:8082",
"grpcs://localhost:8083"
],
"attribute_0": "Price:11",
"attribute_1": "UN-LOCODE:RU MSK",

View file

@ -17,7 +17,9 @@ node:
password: "password"
addresses:
- s01.neofs.devenv:8080
- s02.neofs.devenv:8081
- /dns4/s02.neofs.devenv/tcp/8081
- grpc://127.0.0.1:8082
- grpcs://localhost:8083
attribute_0: "Price:11"
attribute_1: UN-LOCODE:RU MSK
relay: true