Skip to main content

nym_node_requests/api/v1/gateway/
models.rs

1// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
2// SPDX-License-Identifier: Apache-2.0
3
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
8#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
9pub struct Gateway {
10    #[serde(default)]
11    pub enforces_zk_nyms: bool,
12
13    pub client_interfaces: ClientInterfaces,
14}
15
16#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
17#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
18pub struct Wireguard {
19    #[deprecated(note = "use specific port instead (tunnel or metadata service)")]
20    #[cfg_attr(feature = "openapi", schema(example = 51822, default = 51822))]
21    pub port: u16,
22
23    #[cfg_attr(feature = "openapi", schema(example = 51822, default = 51822))]
24    pub tunnel_port: u16,
25
26    #[cfg_attr(feature = "openapi", schema(example = 51830, default = 51830))]
27    pub metadata_port: u16,
28
29    pub public_key: String,
30}
31
32#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
33#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
34pub struct ClientInterfaces {
35    pub wireguard: Option<Wireguard>,
36
37    pub mixnet_websockets: Option<WebSockets>,
38    // pub mixnet_tcp:
39}
40
41#[derive(Serialize, Deserialize, Debug, Clone, Copy, JsonSchema)]
42#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
43pub struct WebSockets {
44    #[cfg_attr(feature = "openapi", schema(example = 9000, default = 9000))]
45    pub ws_port: u16,
46
47    pub wss_port: Option<u16>,
48}
49
50#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
51#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
52pub struct Bridges {
53    pub client_params_path: String,
54}