diff --git a/src/db.rs b/src/db.rs index 51300b5..9463c8c 100644 --- a/src/db.rs +++ b/src/db.rs @@ -134,7 +134,7 @@ impl Database { } pub async fn upsert_open_endpoint(&self, ip: std::net::Ipv4Addr, port: u16) -> Result<()> { - let ip = ip.to_string(); + let ip = std::net::IpAddr::V4(ip); let port = i32::from(port); self.client @@ -148,7 +148,7 @@ impl Database { created_at, updated_at ) - VALUES ($1::inet, $2, NOW(), NOW(), NOW(), NOW()) + VALUES ($1, $2, NOW(), NOW(), NOW(), NOW()) ON CONFLICT (ip) DO UPDATE SET port = EXCLUDED.port, scanned_at = NOW(),