// sandhole: Expose HTTP/SSH/TCP services through SSH port forwarding
// Copyright (C) 2024-2026 Eric Rodrigues Pires
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
// more details.
//
// You should have received a copy of the GNU Affero General Public License along
// with this program. If not, see .
// Original code (CC0 1.0 Universal):
//
use std::{
hash::{Hash, Hasher},
net::IpAddr,
};
use russh::keys::ssh_key::Fingerprint;
// A TCP alias, with an address and a port.
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub(crate) struct KeepaliveAlias(
pub(crate) String,
pub(crate) IpAddr,
pub(crate) Option,
);
impl Hash for KeepaliveAlias {
fn hash(&self, state: &mut H) {
self.0.hash(state);
self.1.hash(state);
self.2
.as_ref()
.map(|fingerprint| fingerprint.as_bytes())
.hash(state);
}
}