One keyboard and mouse for a Mac and a Windows PC over the local network, in either direction.
Beamer 1.5.7
Toby Kalkman27ae29e7c7c1
diff --git a/VERSION b/VERSIONindex eac1e0a..f01291b 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.5.6+1.5.7diff --git a/WIRE.md b/WIRE.mdindex d2307b1..620f922 100644--- a/WIRE.md+++ b/WIRE.md@@ -111,6 +111,7 @@ A peer entry:| `platform` | string | the peer's platform, from pairing, then from every `hello` or `welcome` || `token` | string | the shared token from pairing, never reused for another peer || `host` | string | the IPv4 address to open a link to the peer at; `""` for a phone |+| `host_pinned` | boolean, optional | absent or true preserves the chosen host; false for an address pairing or an incoming link learnt, which may follow discovery || `port` | integer | the peer's own link port; 0 for a phone, which is never dialled || `hw` | string | the peer's hardware address for wake-on-LAN, `aa:bb:cc:dd:ee:ff`, or `""` || `send` | boolean | this machine's input may go to the peer |@@ -468,7 +469,9 @@ AEAD = ChaCha20-Poly1305 (RFC 8439), no associated dataEach end updates the peer entry from what the other sent: `name` and `platform` always, and `hw`when it is present (an absent `hw` keeps the saved one). The responder also takes `port` from`hello`, and `host` from the address the link came from when `port` is not 0 and that address-is neither loopback nor link-local. A change is saved.+is neither loopback nor link-local, but only when the saved host is empty or `host_pinned` is+false. Learning into an empty host sets `host_pinned` false. Pairing writes it false, so an address pairing learnt still follows discovery; legacy entries+without this field are preserved; editing the destination sets it true. A change is saved.Capabilities say what a machine does with a message it receives:@@ -1024,7 +1027,10 @@ Every desktop both announces and discovers. Each sends a beacon every 2 secondswhile it runs, with `pair` and `id` only while a code is up, and each keeps the list of machinesit hears. Any desktop can show a code (and be the host) or enter one (and be the requester).-**Finding a peer whose address changed.** When the link to a peer with `send` true has been down+**Finding a peer whose address changed.** Only entries with `host_pinned` false follow beacons.+A chosen address, including a legacy saved address whose provenance is unknown, is never+replaced automatically. If it changes, edit the destination or pair again.+When the link to an eligible peer with `send` true has been downfor 10 seconds, a desktop tries a link at the source address of a beacon carrying that peer'sexact name, at the peer's saved `port`, and saves the address only once that link authenticates.It never tries a beacon with another name, nor one whose `id` is not the peer's; one at anotherdiff --git a/core/link.py b/core/link.pyindex cf299c5..7a41aa1 100644--- a/core/link.py+++ b/core/link.py@@ -273,6 +273,8 @@ class OutboundLink:self._blocked_for = Nonewith self._lock:tried, self._try_host = self._try_host, None+ if entry.get("host_pinned") is not False:+ tried = Noneif self._blocked_for is not None:self._wake.wait(0.25)self._wake.clear()@@ -879,7 +881,9 @@ class OutboundLink:def follow(self, machines):"""`machines`: what discovery hears, dicts with `name`, `address` and, while that machine shows- a code, `id`. A link down for ten seconds is tried once at the address of a beacon with this+ a code, `id`. Only an address learnt into an empty entry may follow discovery; saved choices,+ including older entries without provenance, stay put. A link down for ten seconds is+ tried once at the address of a beacon with thisentry's exact name, at its saved port, at most every thirty seconds. The address is saved onlyonce the link authenticates. Two machines may share a name, so a beacon whose `id` is anothermachine's is passed over, one at another paired machine's saved address is tried after the@@ -895,6 +899,8 @@ class OutboundLink:entry = self.entry()if entry is None or self._target(entry) is None or not entry.get("name"):return+ if entry.get("host_pinned") is not False:+ returnothers = {peer.get("host") for peer in self._book.peers() if peer.get("token") != self.token}own_id = entry.get("id")found = [m["address"] for m in machinesdiff --git a/core/pairing.py b/core/pairing.pyindex 634fa2f..af38b80 100644--- a/core/pairing.py+++ b/core/pairing.py@@ -333,6 +333,8 @@ def peer_entry(identity: bytes, name: str, platform: str, port: int, token: str,"in_use": True,"side": "", "side_set_at": 0, "side_by": "", "paired_with": [], "paired_at": int(paired_at),"linked": False, "from_1_4": False,+ # Pairing learnt this address; only one typed in Settings is a choice that discovery must not replace.+ "host_pinned": False,}diff --git a/core/receiver.py b/core/receiver.pyindex b3f2c34..2ddda48 100644--- a/core/receiver.py+++ b/core/receiver.py@@ -335,6 +335,14 @@ class PeerBook:return IN_USE_OFF, Nonebefore = copy.deepcopy(entry)was_dormant = entry.get("dormant") is True+ changes = dict(changes)+ # Old entries have no provenance: preserve their selected interface rather than+ # letting discovery or a reverse link silently replace a cable address.+ if "host" in changes:+ if entry.get("host") and entry.get("host_pinned") is not False:+ changes.pop("host")+ elif changes["host"] and not entry.get("host"):+ changes["host_pinned"] = Falseentry.update(changes)entry["linked"] = Trueentry.pop("dormant", None)diff --git a/core/tests/test_link.py b/core/tests/test_link.pyindex d07e8dd..9d30aea 100644--- a/core/tests/test_link.py+++ b/core/tests/test_link.py@@ -845,6 +845,7 @@ class LinkFollowTests(unittest.TestCase):def link(self, clock, tried):side = Side(None)side.peer()["host"] = "192.168.77.7"+ side.peer()["host_pinned"] = Falsedef factory(address, timeout=None):tried.append(address)@@ -946,6 +947,7 @@ class LinkFollowTests(unittest.TestCase):clock = FakeClock()side = Side(machine)side.peer()["host"] = "10.255.255.1"+ side.peer()["host_pinned"] = Falsereal = socket.create_connection@@ -1116,6 +1118,7 @@ class LinkReviewFindingsTests(unittest.TestCase):clock = FakeClock()side = Side(None)side.peer()["host"] = "10.255.255.1"+ side.peer()["host_pinned"] = Falseside.peer()["port"] = server.portreal = socket.create_connectiondiff --git a/core/tests/test_pairing_v3.py b/core/tests/test_pairing_v3.pyindex 86b2d4e..8d25941 100644--- a/core/tests/test_pairing_v3.py+++ b/core/tests/test_pairing_v3.py@@ -505,7 +505,7 @@ class StoreTests(unittest.TestCase):"id": b64(REQUESTER_ID), "name": "Requester Mac", "platform": "macos", "token": token,"host": "192.168.77.5", "port": 24820, "hw": "", "send": True, "allow_drive": True, "in_use": True,"side": "", "side_set_at": 0, "side_by": "", "paired_with": [], "paired_at": 1_790_000_000,- "linked": False, "from_1_4": False,+ "linked": False, "from_1_4": False, "host_pinned": False,})requester_entry = client.entry("192.168.77.4")self.assertEqual(diff --git a/core/tests/test_peer_address.py b/core/tests/test_peer_address.pynew file mode 100644index 0000000..8a90396--- /dev/null+++ b/core/tests/test_peer_address.py@@ -0,0 +1,80 @@+"""Saved destination choices survive discovery and authenticated reverse links."""++import unittest++from core import protocol, receiver+from core.tests.test_link import FakeClock, Side+from core.tests.responder_harness import HERE+++class ChosenAddressTests(unittest.TestCase):+ def test_discovery_does_not_try_another_interface_for_a_saved_choice(self):+ for pinned in (None, True):+ with self.subTest(pinned=pinned):+ side = Side()+ side.peer()["host"] = "192.0.2.10"+ if pinned is not None:+ side.peer()["host_pinned"] = pinned+ clock = FakeClock()+ link = side.link(clock=clock)+ clock.now += 11+ link.follow([{"name": "Far", "address": "198.51.100.10"}])+ self.assertIsNone(link._try_host)+ self.assertEqual(side.peer()["host"], "192.0.2.10")++ def test_reverse_link_cannot_overwrite_a_saved_choice(self):+ side = Side()+ side.peer()["host"] = "192.0.2.10"+ changes = {"host": "198.51.100.10", "name": "New name"}+ outcome, saved = side.book.admit(protocol.key_id(side.peer()["token"]),+ side.own, HERE, changes)+ self.assertEqual(outcome, receiver.ADMITTED)+ self.assertEqual(saved["host"], "192.0.2.10")+ self.assertEqual(saved["name"], "New name")+ self.assertEqual(changes["host"], "198.51.100.10")++ def test_an_empty_address_can_be_learnt_and_followed(self):+ side = Side()+ side.peer()["host"] = ""+ key = protocol.key_id(side.peer()["token"])+ outcome, saved = side.book.admit(key, side.own, HERE, {"host": "192.0.2.10"})+ self.assertEqual(outcome, receiver.ADMITTED)+ self.assertEqual(saved["host"], "192.0.2.10")+ self.assertIs(saved.get("host_pinned"), False)+ clock = FakeClock()+ link = side.link(clock=clock)+ clock.now += 11+ link.follow([{"name": "Far", "address": "198.51.100.10"}])+ self.assertEqual(link._try_host, "198.51.100.10")+ _, saved = side.book.admit(key, side.own, HERE, {"host": "198.51.100.10"})+ self.assertEqual(saved["host"], "198.51.100.10")++ def test_choice_made_after_a_beacon_was_queued_is_used_for_dialling(self):+ side = Side()+ side.peer().update(host="192.0.2.10", host_pinned=True)+ tried = []++ def factory(address, timeout=None):+ tried.append(address)+ link._stop.set()+ raise OSError("synthetic offline peer")++ link = side.link(socket_factory=factory)+ link._try_host = "198.51.100.10"+ link._run()+ self.assertEqual(tried, [("192.0.2.10", 24820)])++ def test_choice_made_during_handshake_wins_over_learned_address(self):+ side = Side()+ side.peer().update(host="192.0.2.10", host_pinned=False)+ key = protocol.key_id(side.peer()["token"])+ side.peer().update(host="203.0.113.10", host_pinned=True)+ _, saved = side.book.admit(key, side.own, HERE, {"host": "198.51.100.10"})+ self.assertEqual(saved["host"], "203.0.113.10")+++class PairedAddressTests(unittest.TestCase):+ def test_pairing_saves_a_followable_address(self):+ from core import pairing+ entry = pairing.peer_entry(bytes(16), "Far", "windows", 24820, "t", "192.0.2.10", 1)+ self.assertIs(entry["host_pinned"], False)diff --git a/core/tests/test_responder_handshake.py b/core/tests/test_responder_handshake.pyindex 325a10d..678dca7 100644--- a/core/tests/test_responder_handshake.py+++ b/core/tests/test_responder_handshake.py@@ -132,6 +132,12 @@ class TheLookup(Case):self.initiator().handshake()self.assertEqual(self.machine.settings.peer(TOKENS[B])["hw"], "11:22:33:44:55:66")+ def test_authenticated_reverse_link_preserves_the_selected_address(self):+ # Treat this loopback client as a learnable LAN source without touching a real interface.+ with mock.patch.object(receiver, "learnable_host", return_value=True):+ self.initiator().handshake()+ self.assertEqual(self.machine.settings.peer(TOKENS[B])["host"], "192.168.77.9")+def test_which_addresses_teach_a_host(self):self.assertTrue(receiver.learnable_host("192.168.77.5", 24820))self.assertTrue(receiver.learnable_host("192.168.1.20", 1))diff --git a/core/tests/test_wayland_scroll_wire.py b/core/tests/test_wayland_scroll_wire.pynew file mode 100644index 0000000..84ca662--- /dev/null+++ b/core/tests/test_wayland_scroll_wire.py@@ -0,0 +1,131 @@+"""Synthetic libei events through capture and the real sender, without a GUI or portal.++These characterise GH16's reported path; passing is not a physical GNOME reproduction.+"""++from pathlib import Path+from types import SimpleNamespace+import sys+import unittest++sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "win_app"))++import capture_portal+import capture_win+import capture_x11+import libei+import sender+from core import owner, protocol+++class ScrollPath:+ def __init__(self):+ self.sent = []+ self.sender = sender.LinkSender(None, lambda: {}, links=lambda _: SimpleNamespace(+ live=lambda peer: True, send_input=lambda peer, message: self.sent.append(message) or True))+ self.sender._owner = owner.Owner(bytes(range(16)), lambda: 0)+ self.sender._owner.on = bytes(range(16, 32))+ self.hooks = capture_portal.Hooks(None, self.mouse, None, tokens=object())+ self.hooks._activation = 3+ self.device = object()+ self.hooks._ei_event(("start", self.device, 3))+ self.context = object.__new__(libei.Context)+ self.context._devices = {1: self.device}+ self.context._lib = SimpleNamespace(+ ei_event_get_type=lambda event: event[0],+ ei_event_get_device=lambda event: 1,+ ei_event_get_time=lambda event: 0,+ ei_event_scroll_get_dx=lambda event: event[1],+ ei_event_scroll_get_dy=lambda event: event[2],+ ei_event_scroll_get_discrete_dx=lambda event: event[1],+ ei_event_scroll_get_discrete_dy=lambda event: event[2],+ )++ def mouse(self, message, x, y, data):+ event = capture_win.mouse_event(message, data)+ if event and event[0] == "wheel":+ return self.sender.on_wheel(event[1], event[2])+ return False++ def feed(self, *events):+ for event in events:+ decoded = self.context._read(event)+ if decoded is not None:+ self.hooks._ei_event(decoded)++ def messages(self):+ while not self.sender._outbound.empty():+ action = self.sender._outbound.get_nowait()+ self.sender._deliver(action)+ result, self.sent = self.sent, []+ return result+++class WaylandScrollWireTests(unittest.TestCase):+ def test_gnome_discrete_wheel_both_axes_and_directions(self):+ for x, y, want in ((0, 120, (-1, 0)), (0, -120, (1, 0)),+ (120, 0, (0, -1)), (-120, 0, (0, 1))):+ with self.subTest(x=x, y=y):+ path = ScrollPath()+ path.feed((603, x, y), (100,))+ self.assertEqual(path.messages(), [protocol.scroll_msg(*want, "line")])++ def test_continuous_scroll_preserves_fractional_notches(self):+ path = ScrollPath()+ path.feed((600, 2.5, -5), (100,))+ self.assertEqual(path.messages(), [protocol.scroll_msg(0.5, 0, "line"),+ protocol.scroll_msg(0, -0.25, "line")])++ def test_high_resolution_discrete_values_are_not_truncated_to_notches(self):+ path = ScrollPath()+ path.feed((603, 0, 15), (100,))+ self.assertEqual(path.messages(), [protocol.scroll_msg(-0.125, 0, "line")])++ def test_sub_wheel_unit_deltas_accumulate_across_frames(self):+ path = ScrollPath()+ for _ in range(4):+ path.feed((600, 0, 0.03125), (100,))+ messages = path.messages()+ self.assertEqual(len(messages), 1)+ self.assertAlmostEqual(messages[0]["data"]["dy"], -1 / 120)++ def test_a_duplicate_continuous_representation_is_not_counted_twice(self):+ path = ScrollPath()+ path.feed((600, 0, 10), (603, 0, 120), (100,))+ self.assertEqual(path.messages(), [protocol.scroll_msg(-1, 0, "line")])++ def test_stop_and_cancel_do_not_erase_wheel_before_frame(self):+ for end in (601, 602):+ with self.subTest(end=end):+ path = ScrollPath()+ path.feed((603, 0, 120), (end,), (100,))+ self.assertEqual(path.messages(), [protocol.scroll_msg(-1, 0, "line")])++ def test_wheel_waits_for_its_frame(self):+ path = ScrollPath()+ path.feed((603, 0, 120))+ self.assertEqual(path.messages(), [])+ path.feed((100,))+ self.assertEqual(path.messages(), [protocol.scroll_msg(-1, 0, "line")])++ def test_windows_wheel_reaches_the_same_wire_message(self):+ path = ScrollPath()+ path.mouse(0x020A, 0, 0, 0xFF880000)+ self.assertEqual(path.messages(), [protocol.scroll_msg(-1, 0, "line")])++ def test_x11_button_wheel_reaches_the_same_wire_message(self):+ path = ScrollPath()+ hooks = capture_x11.Hooks(None, path.mouse, None)+ hooks._button(5, True, 0, False)+ self.assertEqual(path.messages(), [protocol.scroll_msg(-1, 0, "line")])++ def test_x11_smooth_wheel_reaches_the_same_wire_message(self):+ path = ScrollPath()+ hooks = capture_x11.Hooks(None, path.mouse, None)+ hooks._scrolls = {10: {2: (True, 15.0)}}+ hooks._motion(10, {2: 15.0})+ self.assertEqual(path.messages(), [protocol.scroll_msg(-1, 0, "line")])+++if __name__ == "__main__":+ unittest.main()diff --git a/flatpak/uk.co.kalkman.beamer.metainfo.xml b/flatpak/uk.co.kalkman.beamer.metainfo.xmlindex 31aed91..80f7747 100644--- a/flatpak/uk.co.kalkman.beamer.metainfo.xml+++ b/flatpak/uk.co.kalkman.beamer.metainfo.xml@@ -43,6 +43,9 @@</screenshots><content_rating type="oars-1.1"/><releases>+ <release version="1.5.7" date="2026-10-20">+ <description><p>Keeps the address you chose for a machine after reconnects and restarts, instead of replacing it with a discovered or incoming one.</p></description>+ </release><release version="1.5.6" date="2026-10-19"><description><p>Carries the 1.5.5 audit fixes: Korean Han/Yeong and Hanja key repeat on X11, typed machine names on US-English systems, the Crossing shortcut tile subtitle, and the single-display map frame.</p></description></release>diff --git a/mac_app/settings_store.py b/mac_app/settings_store.pyindex 7a8e88b..848d5f4 100644--- a/mac_app/settings_store.py+++ b/mac_app/settings_store.py@@ -310,7 +310,7 @@ def _merge_config(base, cfg):# which clears what was learnt at the old one, or a save from a window read before one was# learnt would put the old one back.if cfg.host != peer.get("host"):- peer.update(name=cfg.pc_name, hw=cfg.mac_address)+ peer.update(name=cfg.pc_name, hw=cfg.mac_address, host_pinned=True)peer.update(host=cfg.host, port=cfg.port, send=cfg.send_to_windows, allow_drive=cfg.allow_windows_to_drive)settings["crossing"] = {name: value for name, value in crossing.items() if not (peerlist.first_desktop(peers) is not None and name in MOVED_CROSSING)diff --git a/mac_app/tests/test_settings_store.py b/mac_app/tests/test_settings_store.pyindex 963feb8..4f76a00 100644--- a/mac_app/tests/test_settings_store.py+++ b/mac_app/tests/test_settings_store.py@@ -15,6 +15,22 @@ from settings_store import SettingsError, SettingsStore, config_to_rawclass SettingsStoreTests(unittest.TestCase):+ def test_editing_a_learnt_host_pins_it_and_survives_reload(self):+ with tempfile.TemporaryDirectory() as directory:+ path = Path(directory) / "settings.json"+ store = SettingsStore(path)+ store.save(self.valid_raw())+ settings = store.current()+ settings["peers"][0]["host_pinned"] = False+ store.save_settings(settings)+ self.assertIs(SettingsStore(path).current()["peers"][0]["host_pinned"], False)+ raw = config_to_raw(store.load())+ raw["host"] = "198.51.100.10"+ store.save(raw)+ peer = SettingsStore(path).current()["peers"][0]+ self.assertEqual(peer["host"], "198.51.100.10")+ self.assertIs(peer["host_pinned"], True)+def test_all_original_saved_colours_keep_their_id_and_stops(self):import notch_beamfixture = Path(__file__).resolve().parents[2] / 'core/tests/colour_packs_rc3.json'diff --git a/mac_app/tests/test_wayland_scroll_mac.py b/mac_app/tests/test_wayland_scroll_mac.pynew file mode 100644index 0000000..b4ef520--- /dev/null+++ b/mac_app/tests/test_wayland_scroll_mac.py@@ -0,0 +1,81 @@+"""GH16 synthetic Linux scroll through the wire parser and Mac injector's CGEvent call.++Run in a Claude session, one module per process. Quartz posting is replaced; no live input.+"""++import json+from pathlib import Path+from types import SimpleNamespace+import sys+import unittest+from unittest import mock++ROOT = Path(__file__).resolve().parents[2]+sys.path.insert(0, str(ROOT))+sys.path.insert(0, str(ROOT / "mac_app"))++import input_injector_mac as injector+from core import protocol, receiver+from core.tests.test_wayland_scroll_wire import ScrollPath+++class WaylandScrollMacTests(unittest.TestCase):+ def setUp(self):+ self.quartz = mock.Mock(kCGScrollEventUnitLine=1, kCGScrollEventUnitPixel=0)+ patch = mock.patch.object(injector, "Quartz", self.quartz)+ patch.start()+ self.addCleanup(patch.stop)+ injector.reset_scroll_remainders()+ self.addCleanup(injector.reset_scroll_remainders)+ self.responder = receiver.LinkResponder(None, lambda: {}, status_callback=None, injector=injector)+ self.responder.input_scale = receiver.InputScale()+ self.link = SimpleNamespace(peer_platform="linux")++ def deliver(self, messages):+ for seq, message in enumerate(messages, 1):+ message["data"]["seq"] = seq+ read = protocol.read_input(json.loads(json.dumps(message)))+ self.assertIsNotNone(read)+ self.responder._inject_locked(self.link, read)++ def test_gnome_wheel_posts_three_lines_per_notch_on_both_axes(self):+ for x, y, want_y, want_x in ((0, 120, -3, 0), (0, -120, 3, 0),+ (120, 0, 0, -3), (-120, 0, 0, 3)):+ with self.subTest(x=x, y=y):+ self.quartz.reset_mock()+ path = ScrollPath()+ path.feed((603, x, y), (100,))+ self.deliver(path.messages())+ self.quartz.CGEventCreateScrollWheelEvent.assert_called_once_with(None, 1, 2, want_y, want_x)+ self.quartz.CGEventPost.assert_called_once()++ def test_high_resolution_wheel_accumulates_instead_of_disappearing(self):+ path = ScrollPath()+ for _ in range(8):+ path.feed((603, 0, 15), (100,))+ self.deliver(path.messages())+ self.assertEqual(self.quartz.CGEventCreateScrollWheelEvent.call_args_list,+ [mock.call(None, 1, 2, -1, 0)] * 3)++ def test_continuous_delta_and_stop_reach_mac(self):+ path = ScrollPath()+ path.feed((600, 0, 10), (601,), (100,))+ self.deliver(path.messages())+ self.quartz.CGEventCreateScrollWheelEvent.assert_called_once_with(None, 1, 2, -3, 0)++ def test_low_scroll_speed_preserves_the_remainder(self):+ self.responder.input_scale = receiver.InputScale(scroll=0.25)+ path = ScrollPath()+ for _ in range(4):+ path.feed((603, 0, 120), (100,))+ self.deliver(path.messages())+ self.assertEqual(self.quartz.CGEventCreateScrollWheelEvent.call_args_list,+ [mock.call(None, 1, 2, -1, 0)] * 3)++ def test_pixel_wire_input_keeps_pixel_units(self):+ self.deliver([protocol.scroll_msg(-10, 5, "pixel")])+ self.quartz.CGEventCreateScrollWheelEvent.assert_called_once_with(None, 0, 2, -10, 5)+++if __name__ == "__main__":+ unittest.main()diff --git a/win_app/app_config.py b/win_app/app_config.pyindex 15bbacf..407358d 100644--- a/win_app/app_config.py+++ b/win_app/app_config.py@@ -897,7 +897,7 @@ def _apply_flat(settings: dict, flat: dict) -> None:# clears what was learnt at the old one, or a save from a window read before one was learnt would# put the old one back.if flat["mac_host"] != peer.get("host"):- peer.update(name=flat["paired_with"], hw=flat["mac_hardware_address"])+ peer.update(name=flat["paired_with"], hw=flat["mac_hardware_address"], host_pinned=True)peer.update(host=flat["mac_host"], send=flat["send_to_mac"], allow_drive=flat["allow_mac_to_drive"])if flat["port"] != old_port and peer.get("port") == old_port:peer["port"] = flat["port"]diff --git a/win_app/tests/test_app_config.py b/win_app/tests/test_app_config.pyindex 1728162..c5e26dd 100644--- a/win_app/tests/test_app_config.py+++ b/win_app/tests/test_app_config.py@@ -19,6 +19,23 @@ from app_config import ConfigError, config_from_dict, config_to_dict, default_coBASE = {"host": "192.168.1.3", "port": 51820, "auth_token": "shared-token"}+class PeerAddressConfigTests(unittest.TestCase):+ def test_editing_a_learnt_host_pins_it_and_survives_reload(self):+ with tempfile.TemporaryDirectory() as directory:+ path = Path(directory) / "settings.json"+ config = config_from_dict({**BASE, "mac_host": "192.0.2.10"})+ app_config.save_config(path, config)+ settings = app_config.load_settings(path)+ settings["peers"][0]["host_pinned"] = False+ app_config.write_settings(path, settings)+ self.assertIs(app_config.load_settings(path)["peers"][0]["host_pinned"], False)+ config = app_config.load_config(path)+ app_config.save_config(path, replace(config, mac_host="198.51.100.10"))+ peer = app_config.load_settings(path)["peers"][0]+ self.assertEqual(peer["host"], "198.51.100.10")+ self.assertIs(peer["host_pinned"], True)++class EdgeGlowConfigTests(unittest.TestCase):def test_defaults_on_and_round_trips(self):self.assertTrue(config_from_dict(dict(BASE)).edge_glow)