Config
Settings stored in the configuration of a node. Use this service to read and change them on any node, such as the carriers a node uses by default when it joins a network.
Get default network carriers
Get the default network carriers of a node. These are the carriers the node receives every time it joins a new network. Returns an empty list when none are configured.
- REST
- gRPC
/v1/nodes/{node_id}/default-network-carriersnode_idstringId of the node to read the default network carriers from.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
const response = await client.config.getDefaultNetworkCarriers({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
});
from nanoping_api import NanopingClient
client = NanopingClient("http://127.0.0.1:10565")
response = client.config.get_default_network_carriers(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
)
curl 'http://127.0.0.1:10565/v1/nodes/<node_id>/default-network-carriers'
carriersDefaultNetworkCarrier[]The default network carriers of the node. Empty when none are configured.
rpc getDefaultNetworkCarriers(GetDefaultNetworkCarriersRequest) returns (GetDefaultNetworkCarriersResponse)
Method /nanopinggrpc.hub.ConfigService/getDefaultNetworkCarriers
node_idstringId of the node to read the default network carriers from.
carriersDefaultNetworkCarrier[]The default network carriers of the node. Empty when none are configured.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/config"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
response, err := c.Config.GetDefaultNetworkCarriers(ctx, &config.GetDefaultNetworkCarriersRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/config"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := config.NewConfigServiceClient(conn)
response, err := stub.GetDefaultNetworkCarriers(ctx, &config.GetDefaultNetworkCarriersRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
})
Set default network carriers
Replace the default network carriers of a node. The new carriers apply to networks the node joins afterwards.
- REST
- gRPC
/v1/nodes/{node_id}/default-network-carriersnode_idstringId of the node to set the default network carriers on.
carriersDefaultNetworkCarrier[]The default network carriers.
- TypeScript
- Python
- curl
import { NanopingClient } from "@nanoping/api";
const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });
await client.config.setDefaultNetworkCarriers({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
carriers: {
carriers: [
{
address: {
ip: "192.168.1.20",
port: 3425,
externalIp: "203.0.113.10"
},
interface: "eth0",
bandwidthPriority: 100
}
]
}
});
from nanoping_api import (
DefaultNetworkCarrier,
DefaultNetworkCarrierAddress,
DefaultNetworkCarriers,
NanopingClient,
)
client = NanopingClient("http://127.0.0.1:10565")
client.config.set_default_network_carriers(
node_id="3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
carriers=DefaultNetworkCarriers(
carriers=[
DefaultNetworkCarrier(
address=DefaultNetworkCarrierAddress(
ip="192.168.1.20",
port=3425,
external_ip="203.0.113.10",
),
interface="eth0",
bandwidth_priority=100,
),
],
),
)
curl -X PUT 'http://127.0.0.1:10565/v1/nodes/<node_id>/default-network-carriers' \
-H 'Content-Type: application/json' \
-d '{
"carriers": [
{
"address": {
"ip": "192.168.1.20",
"port": 3425,
"externalIp": "203.0.113.10"
},
"interface": "eth0",
"bandwidthPriority": 100
}
]
}'
No fields.
rpc setDefaultNetworkCarriers(SetDefaultNetworkCarriersRequest) returns (SetDefaultNetworkCarriersResponse)
Method /nanopinggrpc.hub.ConfigService/setDefaultNetworkCarriers
node_idstringId of the node to set the default network carriers on.
carriersDefaultNetworkCarriersone of optional_carriersThe new default network carriers, replacing the current ones. Leave unset to remove all default carriers.
No fields.
- Go
- Go (generated gRPC)
import (
client "github.com/nanoping-labs/nanoping-api-go/v11"
"github.com/nanoping-labs/nanoping-api-go/v11/config"
)
c, err := client.Connect("127.0.0.1:10432")
defer c.Close()
_, err = c.Config.SetDefaultNetworkCarriers(ctx, &config.SetDefaultNetworkCarriersRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
OptionalCarriers: &config.SetDefaultNetworkCarriersRequest_Carriers{Carriers: &config.DefaultNetworkCarriers{
Carriers: []*config.DefaultNetworkCarrier{
&config.DefaultNetworkCarrier{
OptionalAddress: &config.DefaultNetworkCarrier_Address{Address: &config.DefaultNetworkCarrierAddress{
Ip: "192.168.1.20",
Port: 3425,
OptionalExternalIp: &config.DefaultNetworkCarrierAddress_ExternalIp{ExternalIp: "203.0.113.10"},
}},
OptionalInterface: &config.DefaultNetworkCarrier_Interface{Interface: "eth0"},
OptionalBandwidthPriority: &config.DefaultNetworkCarrier_BandwidthPriority{BandwidthPriority: 100},
},
},
}},
})
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/nanoping-labs/nanoping-api-go/v11/config"
)
conn, err := grpc.NewClient("127.0.0.1:10432", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer conn.Close()
stub := config.NewConfigServiceClient(conn)
_, err = stub.SetDefaultNetworkCarriers(ctx, &config.SetDefaultNetworkCarriersRequest{
NodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
OptionalCarriers: &config.SetDefaultNetworkCarriersRequest_Carriers{Carriers: &config.DefaultNetworkCarriers{
Carriers: []*config.DefaultNetworkCarrier{
&config.DefaultNetworkCarrier{
OptionalAddress: &config.DefaultNetworkCarrier_Address{Address: &config.DefaultNetworkCarrierAddress{
Ip: "192.168.1.20",
Port: 3425,
OptionalExternalIp: &config.DefaultNetworkCarrierAddress_ExternalIp{ExternalIp: "203.0.113.10"},
}},
OptionalInterface: &config.DefaultNetworkCarrier_Interface{Interface: "eth0"},
OptionalBandwidthPriority: &config.DefaultNetworkCarrier_BandwidthPriority{BandwidthPriority: 100},
},
},
}},
})