This commit is contained in:
zhongluofeng
2026-09-12 16:16:57 +08:00
parent 8e940f164b
commit 069aa58c9f
3 changed files with 3 additions and 29 deletions
+1 -13
View File
@@ -3,10 +3,9 @@
//! fnId → 网关 `https://5ddd.com/api/v1/fn/con`authx md5 签名)→ 内网/公网/中继候选 →
//! 探测可达性 → 得到可用的 base_url(含 mode=relay 的中继地址)。
use md5::Md5;
use md5::{Digest, Md5};
use rand::RngCore;
use serde_json::{json, Value};
use sha2::{Digest, Sha256};
/// 网关地址与签名常量(对齐 feiniu-car-music)。
const FN_CONNECT_URL: &str = "https://5ddd.com/api/v1/fn/con";
@@ -19,12 +18,6 @@ fn md5_hex(input: &str) -> String {
format!("{:x}", h.finalize())
}
fn sha256_hex(input: &str) -> String {
let mut h = Sha256::new();
h.update(input.as_bytes());
format!("{:x}", h.finalize())
}
/// 从输入识别 fnId`fnos.net/<id>`、`<id>.5ddd.com`、或裸 fnId。
pub fn extract_fn_id(input: &str) -> Option<String> {
let s = input.trim();
@@ -159,8 +152,3 @@ pub async fn resolve_base_url(fn_id: &str) -> Result<(String, bool), String> {
}
Err(format!("FnConnect 候选均不可达({} 个)", candidates.len()))
}
/// sha256 hex(登录用)。
pub fn sha256_hex_pub(input: &str) -> String {
sha256_hex(input)
}