From 26a27e2b65d18992a0964cc4292c1ea9c90caa97 Mon Sep 17 00:00:00 2001 From: C H Date: Sun, 18 Feb 2024 01:02:24 +0800 Subject: [PATCH] Fixed serve axon and prometheus --- schema/cybernet.json | 92 ++++++++++--------- schema/raw/execute.json | 16 ++-- schema/raw/response_to_get_axon_info.json | 8 +- schema/raw/response_to_get_neuron.json | 12 +-- schema/raw/response_to_get_neuron_lite.json | 12 +-- schema/raw/response_to_get_neurons.json | 12 +-- schema/raw/response_to_get_neurons_lite.json | 12 +-- .../raw/response_to_get_prometheus_info.json | 8 +- schema/raw/response_to_get_state.json | 12 +-- src/msg.rs | 5 +- src/serving.rs | 14 +-- src/state.rs | 6 +- 12 files changed, 111 insertions(+), 98 deletions(-) diff --git a/schema/cybernet.json b/schema/cybernet.json index 5351c5a..05e080c 100644 --- a/schema/cybernet.json +++ b/schema/cybernet.json @@ -187,9 +187,7 @@ ], "properties": { "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -249,9 +247,7 @@ ], "properties": { "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -1459,7 +1455,13 @@ }, "additionalProperties": false } - ] + ], + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } }, "query": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -2361,9 +2363,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -2396,6 +2396,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, @@ -2805,9 +2809,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3016,9 +3018,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3036,6 +3036,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, @@ -3074,9 +3078,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3243,9 +3245,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3263,6 +3263,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, @@ -3297,9 +3301,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3508,9 +3510,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3528,6 +3528,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, @@ -3562,9 +3566,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3731,9 +3733,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3751,6 +3751,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, @@ -3782,9 +3786,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -3802,6 +3804,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, @@ -5625,9 +5631,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -5677,9 +5681,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -5697,6 +5699,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } }, diff --git a/schema/raw/execute.json b/schema/raw/execute.json index a9599e1..1070417 100644 --- a/schema/raw/execute.json +++ b/schema/raw/execute.json @@ -177,9 +177,7 @@ ], "properties": { "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -239,9 +237,7 @@ ], "properties": { "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -1449,5 +1445,11 @@ }, "additionalProperties": false } - ] + ], + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } } diff --git a/schema/raw/response_to_get_axon_info.json b/schema/raw/response_to_get_axon_info.json index 50bef2e..f8e1fc2 100644 --- a/schema/raw/response_to_get_axon_info.json +++ b/schema/raw/response_to_get_axon_info.json @@ -29,9 +29,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -64,6 +62,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/schema/raw/response_to_get_neuron.json b/schema/raw/response_to_get_neuron.json index 8f6619c..ecb48d8 100644 --- a/schema/raw/response_to_get_neuron.json +++ b/schema/raw/response_to_get_neuron.json @@ -33,9 +33,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -244,9 +242,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -264,6 +260,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/schema/raw/response_to_get_neuron_lite.json b/schema/raw/response_to_get_neuron_lite.json index 0578f36..fad659c 100644 --- a/schema/raw/response_to_get_neuron_lite.json +++ b/schema/raw/response_to_get_neuron_lite.json @@ -33,9 +33,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -202,9 +200,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -222,6 +218,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/schema/raw/response_to_get_neurons.json b/schema/raw/response_to_get_neurons.json index 3a5aae5..2c6997d 100644 --- a/schema/raw/response_to_get_neurons.json +++ b/schema/raw/response_to_get_neurons.json @@ -29,9 +29,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -240,9 +238,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -260,6 +256,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/schema/raw/response_to_get_neurons_lite.json b/schema/raw/response_to_get_neurons_lite.json index b823e6f..cbf9403 100644 --- a/schema/raw/response_to_get_neurons_lite.json +++ b/schema/raw/response_to_get_neurons_lite.json @@ -29,9 +29,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -198,9 +196,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -218,6 +214,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/schema/raw/response_to_get_prometheus_info.json b/schema/raw/response_to_get_prometheus_info.json index 098dd81..d6c1489 100644 --- a/schema/raw/response_to_get_prometheus_info.json +++ b/schema/raw/response_to_get_prometheus_info.json @@ -26,9 +26,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -46,6 +44,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/schema/raw/response_to_get_state.json b/schema/raw/response_to_get_state.json index 0dca81c..09b41f8 100644 --- a/schema/raw/response_to_get_state.json +++ b/schema/raw/response_to_get_state.json @@ -1722,9 +1722,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -1774,9 +1772,7 @@ "minimum": 0.0 }, "ip": { - "type": "integer", - "format": "uint128", - "minimum": 0.0 + "$ref": "#/definitions/Uint128" }, "ip_type": { "type": "integer", @@ -1794,6 +1790,10 @@ "minimum": 0.0 } } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" } } } diff --git a/src/msg.rs b/src/msg.rs index e705afa..6d1bb49 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -1,4 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::Uint128; #[cw_serde] pub struct InstantiateMsg {} @@ -30,7 +31,7 @@ pub enum ExecuteMsg { ServeAxon { netuid: u16, version: u32, - ip: u128, + ip: Uint128, port: u16, ip_type: u8, protocol: u8, @@ -40,7 +41,7 @@ pub enum ExecuteMsg { ServePrometheus { netuid: u16, version: u32, - ip: u128, + ip: Uint128, port: u16, ip_type: u8, }, diff --git a/src/serving.rs b/src/serving.rs index 668731a..5e216a2 100644 --- a/src/serving.rs +++ b/src/serving.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{ensure, Addr, DepsMut, Env, MessageInfo, Storage}; +use cosmwasm_std::{ensure, Addr, DepsMut, Env, MessageInfo, Storage, Uint128}; use crate::state::{AxonInfo, AxonInfoOf, PrometheusInfo, PrometheusInfoOf, AXONS, PROMETHEUS}; use crate::uids::is_hotkey_registered_on_any_network; @@ -62,7 +62,7 @@ pub fn do_serve_axon( info: MessageInfo, netuid: u16, version: u32, - ip: u128, + ip: Uint128, port: u16, ip_type: u8, protocol: u8, @@ -81,7 +81,7 @@ pub fn do_serve_axon( // --- 3. Check the ip signature validity. ensure!(is_valid_ip_type(ip_type), ContractError::InvalidIpType {}); ensure!( - is_valid_ip_address(ip_type, ip), + is_valid_ip_address(ip_type, ip.u128()), ContractError::InvalidIpAddress {} ); @@ -173,7 +173,7 @@ pub fn do_serve_prometheus( info: MessageInfo, netuid: u16, version: u32, - ip: u128, + ip: Uint128, port: u16, ip_type: u8, ) -> Result { @@ -189,7 +189,7 @@ pub fn do_serve_prometheus( // --- 3. Check the ip signature validity. ensure!(is_valid_ip_type(ip_type), ContractError::InvalidIpType {}); ensure!( - is_valid_ip_address(ip_type, ip), + is_valid_ip_address(ip_type, ip.u128()), ContractError::InvalidIpAddress {} ); @@ -268,7 +268,7 @@ pub fn get_axon_info(store: &dyn Storage, netuid: u16, hotkey: &Addr) -> AxonInf AxonInfo { block: 0, version: 0, - ip: 0, + ip: Uint128::zero(), port: 0, ip_type: 0, protocol: 0, @@ -289,7 +289,7 @@ pub fn get_prometheus_info(store: &dyn Storage, netuid: u16, hotkey: &Addr) -> P PrometheusInfo { block: 0, version: 0, - ip: 0, + ip: Uint128::zero(), port: 0, ip_type: 0, } diff --git a/src/state.rs b/src/state.rs index e0d966a..86322bd 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::Addr; +use cosmwasm_std::{Addr, Uint128}; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -129,7 +129,7 @@ pub type AxonInfoOf = AxonInfo; pub struct AxonInfo { pub block: u64, // --- Axon serving block. pub version: u32, // --- Axon version - pub ip: u128, // --- Axon u128 encoded ip address of type v6 or v4. + pub ip: Uint128, // --- Axon u128 encoded ip address of type v6 or v4. pub port: u16, // --- Axon u16 encoded port. pub ip_type: u8, // --- Axon ip type, 4 for ipv4 and 6 for ipv6. pub protocol: u8, // --- Axon protocol. TCP, UDP, other. @@ -143,7 +143,7 @@ pub type PrometheusInfoOf = PrometheusInfo; pub struct PrometheusInfo { pub block: u64, // --- Prometheus serving block. pub version: u32, // --- Prometheus version. - pub ip: u128, // --- Prometheus u128 encoded ip address of type v6 or v4. + pub ip: Uint128, // --- Prometheus u128 encoded ip address of type v6 or v4. pub port: u16, // --- Prometheus u16 encoded port. pub ip_type: u8, // --- Prometheus ip type, 4 for ipv4 and 6 for ipv6. }