MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / service_addresses

Function service_addresses

packages/server/src/main.rs:1915–1958  ·  view source on GitHub ↗
(metadata: &ServiceMetadata, selector: Option<&str>)

Source from the content-addressed store, hash-verified

1913}
1914
1915fn service_addresses(metadata: &ServiceMetadata, selector: Option<&str>) -> Vec<PairingAddress> {
1916 let mut addresses = Vec::new();
1917 push_ui_address(&mut addresses, "local", metadata.http_url.clone(), selector);
1918
1919 if let Some(host) = metadata
1920 .advertise_host
1921 .as_deref()
1922 .filter(|host| !host.trim().is_empty())
1923 {
1924 let host = host.trim();
1925 if host != "127.0.0.1" && host != "localhost" {
1926 push_ui_address(
1927 &mut addresses,
1928 if is_tailscale_host(host) {
1929 "tailscale"
1930 } else {
1931 "lan"
1932 },
1933 http_url_for_host(host, metadata.port),
1934 selector,
1935 );
1936 }
1937 }
1938
1939 if let Some(lan_ip) = detect_lan_ip() {
1940 push_ui_address(
1941 &mut addresses,
1942 "lan",
1943 http_url_for_host(&lan_ip.to_string(), metadata.port),
1944 selector,
1945 );
1946 }
1947
1948 if let Some(tailscale_ip) = detect_tailscale_ip() {
1949 push_ui_address(
1950 &mut addresses,
1951 "tailscale",
1952 http_url_for_host(&tailscale_ip.to_string(), metadata.port),
1953 selector,
1954 );
1955 }
1956
1957 addresses
1958}
1959
1960fn push_ui_address(
1961 addresses: &mut Vec<PairingAddress>,

Calls 7

push_ui_addressFunction · 0.85
is_tailscale_hostFunction · 0.85
http_url_for_hostFunction · 0.85
detect_lan_ipFunction · 0.85
detect_tailscale_ipFunction · 0.85
is_emptyMethod · 0.80
cloneMethod · 0.65