[Add] ttpBind

This commit is contained in:
Alois 2026-05-16 19:02:12 +02:00
commit db63f68bee
4 changed files with 25 additions and 9 deletions

4
Cargo.lock generated
View file

@ -3599,7 +3599,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "ttp-core"
version = "0.1.0"
source = "git+https://git.methanium.net/Tensamin/TTP.git#929cb9d3a6aebebe6365973f13062ac2a8e03af6"
source = "git+https://git.methanium.net/Tensamin/TTP.git#7e5d1953df8592a1feba0f390d205d0ef61a3119"
dependencies = [
"base64",
"byteorder",
@ -3612,7 +3612,7 @@ dependencies = [
[[package]]
name = "ttp-native"
version = "0.1.0"
source = "git+https://git.methanium.net/Tensamin/TTP.git#929cb9d3a6aebebe6365973f13062ac2a8e03af6"
source = "git+https://git.methanium.net/Tensamin/TTP.git#7e5d1953df8592a1feba0f390d205d0ef61a3119"
dependencies = [
"quinn",
"rustls",

11
flake.lock generated
View file

@ -59,15 +59,16 @@
"ttp": {
"flake": false,
"locked": {
"lastModified": 1778329030,
"narHash": "sha256-qEEPlOuGVco1g6lI/kfEvIZkJmBbjehuchGWPTywR10=",
"rev": "929cb9d3a6aebebe6365973f13062ac2a8e03af6",
"revCount": 115,
"lastModified": 1778948017,
"narHash": "sha256-hqBYSZnPq7f/F2Z6nJK+6a8ITk6WRCcVBcNT0CR6SnM=",
"ref": "refs/heads/main",
"rev": "7e5d1953df8592a1feba0f390d205d0ef61a3119",
"revCount": 117,
"type": "git",
"url": "https://git.methanium.net/Tensamin/TTP.git"
},
"original": {
"rev": "929cb9d3a6aebebe6365973f13062ac2a8e03af6",
"rev": "7e5d1953df8592a1feba0f390d205d0ef61a3119",
"type": "git",
"url": "https://git.methanium.net/Tensamin/TTP.git"
}

View file

@ -5,7 +5,7 @@
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
ttp = {
url = "git+https://git.methanium.net/Tensamin/TTP.git?rev=929cb9d3a6aebebe6365973f13062ac2a8e03af6";
url = "git+https://git.methanium.net/Tensamin/TTP.git?rev=7e5d1953df8592a1feba0f390d205d0ef61a3119";
flake = false;
};
};
@ -99,6 +99,18 @@
description = "Port for the TTP/QUIC transport server.";
};
ttpBind = lib.mkOption {
type = lib.types.str;
default = "0.0.0.0";
description = "IP address to bind the TTP/QUIC transport server to.";
};
bindAddress = lib.mkOption {
type = lib.types.str;
default = "0.0.0.0";
description = "IP address to bind the HTTP/API server to.";
};
openFirewall = lib.mkOption {
type = lib.types.bool;
default = true;
@ -140,6 +152,8 @@
Environment = [
"API_PORT=${toString cfg.apiPort}"
"OMIKRON_PORT=${toString cfg.transportPort}"
"TTP_BIND=${cfg.ttpBind}"
"BIND_ADDRESS=${cfg.bindAddress}"
];
EnvironmentFile = cfg.environmentFiles;

View file

@ -30,7 +30,8 @@ pub async fn start(port: u16) -> anyhow::Result<()> {
config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
let addr = format!("0.0.0.0:{port}");
let bind_addr = std::env::var("BIND_ADDRESS").unwrap_or_else(|_| "0.0.0.0".to_string());
let addr = format!("{}:{}", bind_addr, port);
log!(" Server on {}", addr);
HttpServer::new(move || {