@@ -23,6 +23,8 @@ struct InfoConfig<'a> {
2323 disks : Option < DisksInfoConfig < ' a > > ,
2424 #[ serde( default , borrow) ]
2525 networks : Option < NetworksInfoConfig < ' a > > ,
26+ #[ serde( default , borrow) ]
27+ public_ip : Option < PublicIpInfoConfig < ' a > > ,
2628}
2729
2830#[ derive( Debug , Deserialize ) ]
@@ -47,6 +49,22 @@ struct NetworksInfoConfig<'a> {
4749 ignore_loopback : Option < bool > ,
4850}
4951
52+ #[ derive( Debug , Deserialize ) ]
53+ struct PublicIpInfoConfig < ' a > {
54+ #[ serde( default , borrow) ]
55+ ipv4_domain : Option < & ' a str > ,
56+ #[ serde( default ) ]
57+ ipv4_port : Option < u16 > ,
58+ #[ serde( default , borrow) ]
59+ ipv4_path : Option < & ' a str > ,
60+ #[ serde( default , borrow) ]
61+ ipv6_domain : Option < & ' a str > ,
62+ #[ serde( default ) ]
63+ ipv6_port : Option < u16 > ,
64+ #[ serde( default , borrow) ]
65+ ipv6_path : Option < & ' a str > ,
66+ }
67+
5068#[ derive( Debug , Deserialize ) ]
5169#[ serde( rename_all = "snake_case" ) ]
5270enum ColorBlockStyle < ' a > {
@@ -243,6 +261,21 @@ impl<'de: 'static> serde::Deserialize<'de> for super::Config {
243261 ignore_loopback : networks. ignore_loopback . unwrap_or ( true ) ,
244262 } )
245263 . unwrap_or_default ( ) ,
264+ public_ip : info
265+ . public_ip
266+ . map ( |public_ip| super :: PublicIpInfoConfig {
267+ ipv4_domain : public_ip
268+ . ipv4_domain
269+ . unwrap_or ( super :: DEFAULT_IPV4_DOMAIN ) ,
270+ ipv4_port : public_ip. ipv4_port . unwrap_or ( super :: DEFAULT_IPV4_PORT ) ,
271+ ipv4_path : public_ip. ipv4_path . unwrap_or ( super :: DEFAULT_IPV4_PATH ) ,
272+ ipv6_domain : public_ip
273+ . ipv6_domain
274+ . unwrap_or ( super :: DEFAULT_IPV6_DOMAIN ) ,
275+ ipv6_port : public_ip. ipv6_port . unwrap_or ( super :: DEFAULT_IPV6_PORT ) ,
276+ ipv6_path : public_ip. ipv6_path . unwrap_or ( super :: DEFAULT_IPV6_PATH ) ,
277+ } )
278+ . unwrap_or_default ( ) ,
246279 } )
247280 . unwrap_or_default ( ) ,
248281 } )
0 commit comments