aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/db/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/db/models.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/db/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/db/models.py b/packages/meshbay-hub/src/meshbay_hub/db/models.py
index 2e36989..7d5a3e3 100644
--- a/packages/meshbay-hub/src/meshbay_hub/db/models.py
+++ b/packages/meshbay-hub/src/meshbay_hub/db/models.py
@@ -72,6 +72,13 @@ class Node(Base):
user_id: Mapped[str] = mapped_column(ForeignKey("users.id"), nullable=False)
pk_node: Mapped[str] = mapped_column(String(64), nullable=False) # Ed25519 b64
endpoint_hint: Mapped[str | None] = mapped_column(String(128)) # "ip:port" or null
+ # The address the hub saw this node connect from, recorded on an announce
+ # that carried a valid Ed25519 signature over a fresh timestamp. Unlike
+ # endpoint_hint — which the node discovers through STUN and sends us — this
+ # is observed rather than claimed, and it is the one to answer questions
+ # with. IPv4 or IPv6.
+ observed_ip: Mapped[str | None] = mapped_column(String(45))
+ last_seen: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
announced_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now)
user: Mapped["User"] = relationship(back_populates="nodes")