Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pony"
version = "0.2.4"
version = "0.2.5"
edition = "2021"
build = "build.rs"

Expand Down Expand Up @@ -32,6 +32,7 @@ ipnet = { version = "2", features=["serde"] }
log = "0.4"
netstat2 = { version = "0.11.1" }
openssl = { version = "0.10", features = ["vendored"] }
percent-encoding = "2"
prost = { version = "0.13" }
prost-derive = { version = "0.13" }
rand = "0.8"
Expand Down
5 changes: 5 additions & 0 deletions dev/dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,9 @@ ALTER TABLE connections ADD COLUMN token UUID DEFAULT NULL;

ALTER TABLE inbounds ADD COLUMN h2 JSONB DEFAULT NULL;

ALTER TABLE inbounds ADD COLUMN mtproto_secret TEXT DEFAULT NULL;

ALTER TYPE proto ADD VALUE 'mtproto';



15 changes: 14 additions & 1 deletion src/bin/agent/core/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,27 @@ pub async fn run(settings: AgentSettings) -> Result<()> {
None
};

// Init Mtproto
let mtproto_config = if settings.mtproto.enabled {
Some(settings.mtproto.clone())
} else {
None
};

let subscriber = ZmqSubscriber::new(
&settings.zmq.endpoint,
&settings.node.uuid,
&settings.node.env,
);

let node_config = NodeConfig::from_raw(settings.node.clone());
let node = Node::new(node_config?, xray_config, wg_config.clone(), h2_config);
let node = Node::new(
node_config?,
xray_config,
wg_config.clone(),
h2_config,
mtproto_config,
);

let memory: Arc<RwLock<AgentState>> =
Arc::new(RwLock::new(MemoryCache::with_node(node.clone())));
Expand Down
6 changes: 6 additions & 0 deletions src/bin/agent/core/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ where
Tag::Hysteria2 => {
return Err(PonyError::Custom("Hysteria2 is not supported".into()))
}
Tag::Mtproto => {
return Err(PonyError::Custom("Mtproto is not supported".into()))
}
}
}

Expand Down Expand Up @@ -299,6 +302,9 @@ where
Tag::Hysteria2 => {
return Err(PonyError::Custom("Hysteria2 is not supported".into()))
}
Tag::Mtproto => {
return Err(PonyError::Custom("Mtproto is not supported".into()))
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/bin/api/core/http/handlers/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ where
ProtoTag::Hysteria2 => Proto::Hysteria2 {
token: conn_req.token.unwrap(),
},
ProtoTag::Mtproto => unreachable!("Mtproto handled earlier"),
};

drop(mem);
Expand Down
167 changes: 167 additions & 0 deletions src/bin/api/core/http/handlers/html.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
pub static HEAD: &str = r#"<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Информация о подписке</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
background: #0f172a;
color: #e5e7eb;
max-width: 720px;
margin: 40px auto;
padding: 24px;
}
.card {
background: #020617;
border-radius: 12px;
padding: 24px;
box-shadow: 0 0 0 1px #1e293b;
}
h1, h2, h3 {
margin-top: 0;
}
.stat {
margin: 8px 0;
}
.status-active {
color: #22c55e;
font-weight: 600;
}
.status-expired {
color: #ef4444;
font-weight: 600;
}
a {
color: #38bdf8;
text-decoration: none;
}
button {
margin-top: 6px;
padding: 6px 12px;
border-radius: 6px;
border: none;
background: #1e293b;
color: #e5e7eb;
cursor: pointer;
}
button:hover {
background: #334155;
}
button-id:hover {
background: #334155;
font-size: 10px;

}
.qr {
margin-top: 16px;
text-align: center;
}
.small {
font-size: 13px;
color: #94a3b8;
}
.small-id {
font-size: 11px;
color: #94a3b8;
text-align: right;
margin-top: 0px;
}
.small-viva {
font-size: 13px;
color: #94a3b8;
text-align: right;
margin-top: 0px;
}
.badge {
font-size: 12px;
color: var(--accent-2);
border: 1px solid rgba(34, 211, 238, 0.3);
padding: 4px 10px;
border-radius: 999px;
}
.footer-line {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 8px;
}
ul {
padding-left: 20px;
}

.proxy-list {
list-style: none;
padding: 0;
margin: 20px 0;
display: flex;
flex-direction: column;
gap: 12px;
}
.proxy-item {
border-radius: 14px;
overflow: hidden;
transition: all 0.25s ease;
}

.proxy-item a {
display: flex;
justify-content: space-between;
align-items: center;

padding: 16px 18px;

text-decoration: none;
color: #e5e7eb;

background: rgba(15, 23, 42, 0.6);
border: 1px solid rgba(148, 163, 184, 0.15);

backdrop-filter: blur(8px);
border-radius: 14px;

transition: all 0.25s ease;
}

/* hover glow */
.proxy-item a:hover {
background: rgba(30, 41, 59, 0.9);
border-color: rgba(56, 189, 248, 0.6);
transform: translateY(-2px);
box-shadow:
0 0 0 1px rgba(56,189,248,0.3),
0 8px 24px rgba(0,0,0,0.4);
}

/* label */
.proxy-label {
font-size: 16px;
font-weight: 600;
letter-spacing: 0.3px;
}

/* connect badge */
.proxy-action {
font-size: 13px;
padding: 6px 12px;
border-radius: 999px;

background: linear-gradient(
135deg,
#38bdf8,
#818cf8
);

color: #020617;
font-weight: 600;
}
</style>
</head>"#;

pub static FOOTER: &str = r#"
<div class=footer-line>
<div class=small-viva>
<a href=https://t.me/frkn_support>Поддержка &nbsp·</a></div>

<div class=small-viva > &nbsp Vive la résistance! </div>
</div>"#;
1 change: 1 addition & 0 deletions src/bin/api/core/http/handlers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod connection;
pub mod html;
pub mod node;
pub mod sub;

Expand Down
Loading
Loading