@@ -203,18 +203,18 @@ pub struct GatewayConfigResponse {
203203}
204204
205205// ============================================================================
206- // Хелперы
206+ // Helpers
207207// ============================================================================
208208
209- /// Извлекает subscription_id из auth_data.
209+ /// Extracts subscription_id from auth_data.
210210fn extract_subscription_id ( auth_data : & serde_json:: Value ) -> Option < uuid:: Uuid > {
211211 auth_data
212212 . get ( "id" )
213213 . and_then ( |v| v. as_str ( ) )
214214 . and_then ( |s| uuid:: Uuid :: parse_str ( s) . ok ( ) )
215215}
216216
217- /// Проверяет, соответствует ли тег протоколу из запроса клиента .
217+ /// Checks whether the tag matches the protocol from the client request .
218218fn proto_matches ( tag : Tag , protocol : & str ) -> bool {
219219 match protocol {
220220 "awg" => tag == Tag :: AmneziaWg ,
@@ -229,7 +229,7 @@ fn proto_matches(tag: Tag, protocol: &str) -> bool {
229229 }
230230}
231231
232- /// Возвращает человекочитаемое название инбаунда по тегу .
232+ /// Returns a human-readable inbound name for the given tag .
233233fn inbound_label ( tag : Tag ) -> & ' static str {
234234 match tag {
235235 Tag :: VlessTcpReality => "VLESS TCP Reality" ,
@@ -245,8 +245,8 @@ fn inbound_label(tag: Tag) -> &'static str {
245245 }
246246}
247247
248- /// Возвращает список connection'ов для заданного протокола .
249- /// Для каждой онлайн-ноды с нужным инбаундом ищет matching connection подписки .
248+ /// Returns the list of connections for the given protocol .
249+ /// For each online node with the required inbound, finds a matching connection of the subscription .
250250fn connections_for_protocol < N , C > (
251251 nodes : & N ,
252252 protocol : & str ,
@@ -271,7 +271,7 @@ where
271271 if !proto_matches ( tag, protocol) {
272272 continue ;
273273 }
274- // connection можно сопоставить только с нодой, у которой есть точно такой же inbound
274+ // A connection can only be matched with a node that has exactly the same inbound.
275275 if !node. inbounds . values ( ) . any ( |i| i. tag == tag) {
276276 continue ;
277277 }
@@ -311,7 +311,7 @@ where
311311 result
312312}
313313
314- /// Возвращает уникальный список стран из connection'ов (для available_countries).
314+ /// Returns a unique list of countries from the connections (for available_countries).
315315fn available_countries_from_connections ( conns : & [ GatewayConnection ] ) -> Vec < GatewayCountry > {
316316 let mut seen = std:: collections:: HashSet :: new ( ) ;
317317 let mut countries = Vec :: new ( ) ;
@@ -328,7 +328,7 @@ fn available_countries_from_connections(conns: &[GatewayConnection]) -> Vec<Gate
328328 countries
329329}
330330
331- /// Строит Amnezia server config для AWG.
331+ /// Builds the Amnezia server config for AWG.
332332fn build_awg_server_config (
333333 ini_config : & str ,
334334 client_priv_key : & str ,
@@ -411,7 +411,7 @@ fn build_awg_server_config(
411411 } )
412412}
413413
414- /// Строит Amnezia server config для VLESS/XRay из реального inbound.
414+ /// Builds the Amnezia server config for VLESS/XRay from the real inbound.
415415fn build_vless_server_config (
416416 inbound : & fcore:: Inbound ,
417417 conn_id : & uuid:: Uuid ,
@@ -662,7 +662,7 @@ fn build_vless_server_config(
662662}
663663
664664// ============================================================================
665- // Обработчики
665+ // Handlers
666666// ============================================================================
667667
668668pub async fn gateway_services_handler < N , C , S > (
@@ -684,7 +684,7 @@ where
684684{
685685 let mem = memory. memory . read ( ) . await ;
686686
687- // Если передан subscription_id, берём реальный end_date из подписки и её connections
687+ // If subscription_id is provided, use the real subscription end_date and its connections.
688688 let sub_id = req. auth_data . as_ref ( ) . and_then ( extract_subscription_id) ;
689689 let end_date = sub_id
690690 . and_then ( |sub_id| mem. subscriptions . find_by_id ( & sub_id) )
@@ -798,7 +798,7 @@ where
798798 let conns = mem. connections . get_by_subscription_id ( & sub_id) ;
799799 let active_devices = conns. as_ref ( ) . map ( |c| c. len ( ) as i64 ) . unwrap_or ( 0 ) ;
800800
801- // Собираем issued_configs из реальных connections
801+ // Build issued_configs from real connections.
802802 let issued_configs: Vec < GatewayIssuedConfig > = conns
803803 . unwrap_or_default ( )
804804 . into_iter ( )
@@ -940,7 +940,7 @@ where
940940 continue ;
941941 }
942942
943- // Нода должна иметь точно такой же inbound, как у connection
943+ // The node must have exactly the same inbound as the connection.
944944 let has_inbound = node. inbounds . values ( ) . any ( |i| i. tag == conn_tag) ;
945945 if !has_inbound {
946946 continue ;
0 commit comments