config: allow hostnames for camera addresses

This offers more flexibility, as a camera system admin only
needs a DNS assignment rather than DHCP. The syntax is still
as expected:

address = "cameras.example.com:9000"

This is especially handy in more complex topologies, where one
or more specified "camera" may actually be pointed at a system
providing a tunnel through to multiple cameras; names make it
easier to identify said gateway machine.

All IPs that the given name resolves to are tried so that we
correctly handle, e.g., a name with both AAAA and A records.

Note that addresses are no longer validated up front, but instead
simply get resolved when the connection attempt is made.

Name resolution will be aborted after ~60s of failure.
This commit is contained in:
Kyle Evans committed 2020-12-07 20:15:47 -06:00
1 parent 32400971a5
commit 2e8126cd73
3 files changed
+32 -18

No files matched your search

+1 -2
View File
@@ -2,7 +2,6 @@ use lazy_static::lazy_static;
use regex::Regex;
use serde::Deserialize;
use std::clone::Clone;
use std::net::SocketAddr;
use std::time::Duration;
use validator::{Validate, ValidationError};
use validator_derive::Validate;
@@ -45,7 +44,7 @@ pub struct CameraConfig {
pub name: String,
#[serde(rename = "address")]
pub camera_addr: SocketAddr,
pub camera_addr: String,
pub username: String,
pub password: Option<String>,