moshpit 0.19.0

moshpit client (mp) — encrypted, resilient remote terminal session client
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
// Copyright (c) 2025 moshpit developers
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. All files in the project carrying such notice may not be copied,
// modified, or distributed except according to those terms.

use std::{collections::BTreeSet, env::var, path::PathBuf, sync::Arc};

use anyhow::Result;
use config::{File, FileFormat};
use getset::{CopyGetters, Getters, Setters};
use libmoshpit::{
    AlgorithmList, DiffMode, DisplayPreference, FileLayer, KEY_ALGORITHM_X25519, KexConfig,
    KexMode, KeyPair, ServerTarget, config_file_path, load, load_with_overlay,
    parse_server_destination, supported_algorithms,
};
use serde::{Deserialize, Serialize};
use tokio::sync::Mutex;
use uuid::Uuid;

use crate::{
    cli::Cli,
    hosts::{apply_host_aliases, destination_host, host_settings_from_file},
};

/// Per-category algorithm preferences for TOML config and CLI overrides.
/// Each field is optional; missing categories fall back to `supported_algorithms()`.
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub(crate) struct AlgorithmPreferences {
    #[serde(default)]
    pub(crate) kex: Option<Vec<String>>,
    #[serde(default)]
    pub(crate) aead: Option<Vec<String>>,
    #[serde(default)]
    pub(crate) mac: Option<Vec<String>>,
    #[serde(default)]
    pub(crate) kdf: Option<Vec<String>>,
}

impl AlgorithmPreferences {
    fn into_algorithm_list(self) -> AlgorithmList {
        let defaults = supported_algorithms();
        AlgorithmList {
            kex: self.kex.unwrap_or(defaults.kex),
            aead: self.aead.unwrap_or(defaults.aead),
            mac: self.mac.unwrap_or(defaults.mac),
            kdf: self.kdf.unwrap_or(defaults.kdf),
        }
    }
}

/// Client diff-mode preference parsed from `--diff-mode` / `MOSHPIT_DIFF_MODE` /
/// TOML.  `Auto` (the default) resolves to a concrete [`DiffMode`] based on the
/// negotiated transport: `StateSync` over TCP, `Reliable` over UDP.  An explicit
/// mode is always honored regardless of transport.
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub(crate) enum DiffModePref {
    /// Transport-dependent default: `StateSync` over TCP, `Reliable` over UDP.
    #[default]
    Auto,
    /// NAK-based selective retransmission.
    Reliable,
    /// Fire-and-forget diffs with periodic full-screen snapshots.
    Datagram,
    /// Mosh-style ack-based incremental diffs.
    Statesync,
}

/// Client-side tracing configuration — file layer only.
/// The mp client never writes to stdout, so there is no stdout layer.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getters, PartialEq, Serialize)]
pub(crate) struct ClientTracing {
    #[getset(get = "pub(crate)")]
    file: FileLayer,
}

#[derive(Clone, CopyGetters, Debug, Deserialize, Eq, Getters, PartialEq, Serialize, Setters)]
pub(crate) struct Config {
    #[serde(skip_deserializing)]
    #[getset(get_copy = "pub(crate)")]
    mode: KexMode,
    #[serde(skip_deserializing)]
    #[getset(get = "pub(crate)", set = "pub(crate)")]
    user: String,
    #[serde(default)]
    #[getset(get = "pub(crate)")]
    tracing: ClientTracing,
    #[serde(default = "Config::default_server_port")]
    #[getset(get_copy = "pub(crate)")]
    server_port: u16,
    #[serde(default)]
    #[getset(get = "pub(crate)", set = "pub(crate)")]
    server_destination: String,
    #[getset(get = "pub(crate)")]
    private_key_path: Option<String>,
    #[getset(get = "pub(crate)")]
    public_key_path: Option<String>,
    /// UUID of a previous session to attempt to resume (not persisted to config file).
    #[serde(skip)]
    #[getset(get_copy = "pub(crate)", set = "pub(crate)")]
    resume_session_uuid: Option<Uuid>,
    /// Display name of a previous session to attempt to resume via `--attach`
    /// (not persisted to config file) — an alternative to `resume_session_uuid`.
    #[serde(skip)]
    #[getset(get = "pub(crate)", set = "pub(crate)")]
    resume_session_name: Option<String>,
    /// Display name to request for a *new* session, as `(name, explicit)` —
    /// `explicit` is `true` for a user-supplied `--session-name`, `false` for
    /// a client-computed default (not persisted to config file).
    #[serde(skip)]
    #[getset(get = "pub(crate)", set = "pub(crate)")]
    session_name: Option<(String, bool)>,
    /// Command to run instead of the login shell for a *new* session (`mp
    /// host -- cmd`), already joined into one string.  Set only for the first
    /// connect attempt (not persisted to config file).
    #[serde(skip)]
    #[getset(get = "pub(crate)", set = "pub(crate)")]
    remote_command: Option<String>,
    /// The remote-command session this run created, held in memory so
    /// reconnects resume it without touching (or reading) the per-terminal
    /// session cache — which keeps pointing at the user's interactive session.
    /// While set, reconnects are `resume_only`: the server refuses rather than
    /// replaces a session whose command has exited (not persisted to config
    /// file).
    #[serde(skip)]
    #[getset(get_copy = "pub(crate)", set = "pub(crate)")]
    pinned_session_uuid: Option<Uuid>,
    /// Maximum backoff interval between reconnect attempts, in seconds.
    /// Clamped to [2, 86400] (24 hours).  Defaults to 3600 (1 hour).
    #[serde(default = "Config::default_max_reconnect_backoff_secs")]
    #[getset(get_copy = "pub(crate)")]
    max_reconnect_backoff_secs: u64,
    /// Local-echo prediction display preference.
    #[serde(default)]
    #[getset(get_copy = "pub(crate)")]
    predict: DisplayPreference,
    /// Send NAT warmup keepalives before the UDP session loop starts.
    /// Off by default; enable with `--nat-warmup` / `MOSHPIT_NAT_WARMUP=true`.
    #[serde(default)]
    #[getset(get_copy = "pub(crate)")]
    nat_warmup: bool,
    /// Number of keepalive frames to send during NAT warmup.
    #[serde(default = "Config::default_nat_warmup_count")]
    #[getset(get_copy = "pub(crate)")]
    nat_warmup_count: u32,
    /// Diff transport mode preference.  Defaults to `Auto`, which resolves to
    /// `StateSync` over TCP and `Reliable` over UDP (see [`Config::diff_mode`]).
    /// Set explicitly via `--diff-mode <mode>` / `MOSHPIT_DIFF_MODE=<mode>`.
    #[serde(default)]
    diff_mode: DiffModePref,
    /// Data-channel transport mode.  `udp` (default) uses encrypted UDP;
    /// `tcp` uses the server's TCP data port (fallback for UDP-blocking firewalls).
    /// Set via `--transport tcp` / `MOSHPIT_TRANSPORT=tcp`.
    #[serde(default)]
    #[getset(get_copy = "pub(crate)")]
    transport: libmoshpit::TransportMode,
    /// Legacy escape hatch: drive the terminal by forwarding raw server PTY
    /// bytes straight to stdout instead of rendering exclusively through the
    /// differential renderer.  Defaults to `false` (the artifact-free rendered
    /// path).  Enable via `--legacy-passthrough` / `MOSHPIT_LEGACY_PASSTHROUGH=true`
    /// only if the rendered path regresses.
    #[serde(default)]
    #[getset(get_copy = "pub(crate)")]
    legacy_passthrough: bool,
    /// Probe the real terminal's foreground/background colors once at session
    /// startup (an `OSC 10`/`11` query to the local terminal) and use them to
    /// answer the remote shell's `OSC 10`/`11`/`12` color queries, instead of a
    /// hardcoded canned theme. Defaults to `true`; disable via `--no-color-probe`
    /// / `MOSHPIT_NO_COLOR_PROBE=true` if a terminal answers the probe incorrectly
    /// or hangs.
    #[serde(default = "Config::default_true")]
    #[getset(get_copy = "pub(crate)")]
    probe_terminal_colors: bool,
    /// Per-category algorithm overrides from TOML `[preferred_algorithms]` or CLI flags.
    #[serde(default)]
    preferred_algorithms: AlgorithmPreferences,
    /// Environment variable name patterns to send to the server via `ClientEnv`.
    /// Supports exact names (`LANG`) and suffix wildcards (`LC_*`).
    #[serde(default = "Config::default_send_env")]
    #[getset(get = "pub(crate)")]
    send_env: Vec<String>,
    /// Additional PATH directories to prepend to the server's `server_path`.
    /// Sent via `ClientEnv`; ignored by the server when `path_locked = true`.
    #[serde(default)]
    #[getset(get = "pub(crate)")]
    send_path: Vec<String>,
    /// Escape prefix key, e.g. `"ctrl-^"` (default).  Followed by `.` to quit,
    /// `Ctrl-Z` to suspend, `?` for help, or the prefix again to send it
    /// (see `runtime::escape_feed`).  Must resolve to a control byte; parsed and
    /// validated at startup by `runtime::parse_escape_key`.
    #[serde(default = "Config::default_escape_key")]
    #[getset(get = "pub(crate)")]
    escape_key: String,
    /// `hostname` from the matching `[[hosts]]` blocks: where to connect
    /// instead of the host typed (set by [`load_config`]).
    #[serde(skip)]
    #[getset(get = "pub(crate)")]
    host_hostname: Option<String>,
    /// `user` from the matching `[[hosts]]` blocks, used when the destination
    /// has no `user@` (set by [`load_config`]).
    #[serde(skip)]
    #[getset(get = "pub(crate)")]
    host_user: Option<String>,
    /// The `match` patterns of the `[[hosts]]` blocks that applied, in order.
    #[serde(skip)]
    #[getset(get = "pub(crate)")]
    host_blocks: Vec<String>,
    /// Option keys the matching `[[hosts]]` blocks set (nested as
    /// `table.key`), for `mp ec`'s source column.
    #[serde(skip)]
    #[getset(get = "pub(crate)")]
    host_keys: BTreeSet<String>,
}

/// Load the client config, applying the `[[hosts]]` blocks that match
/// `destination` (or, when `None`, the configured `server_destination`).
///
/// The file is loaded once to find the destination, then again with the
/// matching blocks' options layered between the file's top-level settings and
/// the command line (`env > CLI > [[hosts]] > file`).
///
/// # Errors
/// Fails if the config can't be loaded, or a `[[hosts]]` block is malformed
/// or sets an option it can't.
pub(crate) fn load_config(cli: &Cli, destination: Option<&str>) -> Result<Config> {
    let config: Config = load::<Cli, Config, Cli>(cli, cli, false)?;
    let destination =
        destination.map_or_else(|| config.server_destination().clone(), str::to_owned);
    if destination.is_empty() {
        return Ok(config);
    }
    let path = config_file_path(cli)?;
    let settings = host_settings_from_file(&path, destination_host(&destination))?;
    if settings.matched.is_empty() {
        return Ok(config);
    }
    let overlay = File::from_str(&toml::to_string(&settings.overlay)?, FileFormat::Toml);
    let mut config: Config =
        load_with_overlay::<Cli, Config, Cli>(cli, cli, false, vec![Box::new(overlay)])?;
    config.host_keys = settings.keys();
    config.host_hostname = settings.hostname;
    config.host_user = settings.user;
    config.host_blocks = settings.matched;
    Ok(config)
}

impl Config {
    fn default_server_port() -> u16 {
        40404
    }

    fn default_max_reconnect_backoff_secs() -> u64 {
        3600
    }

    fn default_nat_warmup_count() -> u32 {
        3
    }

    fn default_true() -> bool {
        true
    }

    fn default_send_env() -> Vec<String> {
        vec!["LANG".into(), "LC_*".into(), "TZ".into()]
    }

    fn default_escape_key() -> String {
        "ctrl-^".to_string()
    }

    /// Resolve the configured [`DiffModePref`] to a concrete [`DiffMode`].
    ///
    /// `Auto` picks `StateSync` over the TCP transport (incremental diffs keep
    /// server CPU low) and `Reliable` over UDP (the historical default).  An
    /// explicit preference is returned unchanged.
    pub(crate) fn diff_mode(&self) -> DiffMode {
        match self.diff_mode {
            DiffModePref::Reliable => DiffMode::Reliable,
            DiffModePref::Datagram => DiffMode::Datagram,
            DiffModePref::Statesync => DiffMode::StateSync,
            DiffModePref::Auto => match self.transport {
                libmoshpit::TransportMode::Tcp => DiffMode::StateSync,
                libmoshpit::TransportMode::Udp => DiffMode::Reliable,
            },
        }
    }

    /// The user and server to connect to for `destination`, with the matching
    /// `[[hosts]]` blocks' `hostname` and `user` applied (a `user@` or `:port`
    /// typed in `destination` still wins).
    ///
    /// # Errors
    /// Fails if the resulting destination doesn't parse.
    pub(crate) fn connect_target(&self, destination: &str) -> Result<(String, ServerTarget)> {
        let destination = apply_host_aliases(
            destination,
            self.host_hostname.as_deref(),
            self.host_user.as_deref(),
        );
        parse_server_destination(&destination, self.server_port)
    }

    fn load_key_paths(&self) -> Result<(PathBuf, PathBuf)> {
        let (default_private_key_path, default_pub_key_ext) =
            KeyPair::default_key_path_ext(self.mode, KEY_ALGORITHM_X25519)?;
        let private_key_path = self
            .private_key_path
            .as_ref()
            .map_or(default_private_key_path, PathBuf::from);
        let public_key_path = self.public_key_path.as_ref().map_or(
            private_key_path.with_extension(default_pub_key_ext),
            PathBuf::from,
        );
        Ok((private_key_path, public_key_path))
    }
}

impl Default for Config {
    fn default() -> Self {
        Config {
            mode: KexMode::Client,
            user: String::new(),
            tracing: ClientTracing::default(),
            server_port: Self::default_server_port(),
            server_destination: String::new(),
            private_key_path: None,
            public_key_path: None,
            resume_session_uuid: None,
            resume_session_name: None,
            session_name: None,
            remote_command: None,
            pinned_session_uuid: None,
            max_reconnect_backoff_secs: Self::default_max_reconnect_backoff_secs(),
            predict: DisplayPreference::default(),
            nat_warmup: false,
            nat_warmup_count: Self::default_nat_warmup_count(),
            diff_mode: DiffModePref::default(),
            transport: libmoshpit::TransportMode::default(),
            legacy_passthrough: false,
            probe_terminal_colors: Self::default_true(),
            preferred_algorithms: AlgorithmPreferences::default(),
            send_env: Self::default_send_env(),
            send_path: Vec::new(),
            escape_key: Self::default_escape_key(),
            host_hostname: None,
            host_user: None,
            host_blocks: Vec::new(),
            host_keys: BTreeSet::new(),
        }
    }
}

impl KexConfig for Config {
    fn mode(&self) -> KexMode {
        self.mode
    }

    fn port_pool(&self) -> Option<Arc<Mutex<BTreeSet<u16>>>> {
        None
    }

    fn key_pair_paths(&self) -> Result<(PathBuf, PathBuf)> {
        self.load_key_paths()
    }

    fn user(&self) -> Option<String> {
        self.user.clone().into()
    }

    fn resume_session_uuid(&self) -> Option<Uuid> {
        self.resume_session_uuid
    }

    fn resume_session_name(&self) -> Option<String> {
        self.resume_session_name.clone()
    }

    fn session_name(&self) -> Option<(String, bool)> {
        self.session_name.clone()
    }

    fn remote_command(&self) -> Option<String> {
        self.remote_command.clone()
    }

    fn resume_only(&self) -> bool {
        self.pinned_session_uuid.is_some()
    }

    fn server_id(&self) -> Option<String> {
        Some(self.server_destination().clone())
    }

    fn diff_mode(&self) -> DiffMode {
        // Delegate to the inherent resolver (handles the `Auto` default).
        Config::diff_mode(self)
    }

    fn transport_preference(&self) -> libmoshpit::TransportMode {
        self.transport
    }

    fn preferred_algorithms(&self) -> AlgorithmList {
        self.preferred_algorithms.clone().into_algorithm_list()
    }

    fn send_env(&self) -> Vec<String> {
        self.send_env.clone()
    }

    fn send_path(&self) -> Vec<String> {
        self.send_path.clone()
    }

    fn agent_socket(&self) -> Option<PathBuf> {
        var("MOSHPIT_AGENT_SOCK").ok().map(PathBuf::from)
    }
}

#[cfg(test)]
mod tests {
    use std::path::PathBuf;

    use anyhow::Result;
    use uuid::Uuid;

    use libmoshpit::{DiffMode, TransportMode};

    use super::{Config, DisplayPreference, KexConfig, KexMode};

    #[test]
    fn test_transport_defaults_to_udp() {
        let config = Config::default();
        assert_eq!(config.transport(), TransportMode::Udp);
        assert_eq!(config.transport_preference(), TransportMode::Udp);
    }

    #[test]
    fn test_transport_tcp_from_toml() -> Result<()> {
        let toml = r#"
            private_key_path = "/tmp/priv"
            public_key_path = "/tmp/pub"
            transport = "tcp"
        "#;
        let config: Config = toml::from_str(toml)?;
        assert_eq!(config.transport(), TransportMode::Tcp);
        assert_eq!(config.transport_preference(), TransportMode::Tcp);
        Ok(())
    }

    #[test]
    fn test_transport_absent_in_toml_defaults_udp() -> Result<()> {
        let toml = r#"
            private_key_path = "/tmp/priv"
            public_key_path = "/tmp/pub"
        "#;
        let config: Config = toml::from_str(toml)?;
        assert_eq!(config.transport_preference(), TransportMode::Udp);
        Ok(())
    }

    #[test]
    fn auto_diff_mode_resolves_reliable_over_udp() {
        // Default config (UDP transport, Auto diff mode) keeps the historical
        // UDP default of Reliable.
        let config = Config::default();
        assert_eq!(config.diff_mode(), DiffMode::Reliable);
    }

    #[test]
    fn auto_diff_mode_resolves_statesync_over_tcp() -> Result<()> {
        let toml = r#"
            private_key_path = "/tmp/priv"
            public_key_path = "/tmp/pub"
            transport = "tcp"
        "#;
        let config: Config = toml::from_str(toml)?;
        assert_eq!(config.diff_mode(), DiffMode::StateSync);
        Ok(())
    }

    #[test]
    fn explicit_diff_mode_overrides_tcp_statesync_default() -> Result<()> {
        let toml = r#"
            private_key_path = "/tmp/priv"
            public_key_path = "/tmp/pub"
            transport = "tcp"
            diff_mode = "reliable"
        "#;
        let config: Config = toml::from_str(toml)?;
        assert_eq!(config.diff_mode(), DiffMode::Reliable);
        Ok(())
    }

    #[test]
    fn explicit_statesync_honored_over_udp() -> Result<()> {
        let toml = r#"
            private_key_path = "/tmp/priv"
            public_key_path = "/tmp/pub"
            diff_mode = "statesync"
        "#;
        let config: Config = toml::from_str(toml)?;
        assert_eq!(config.transport_preference(), TransportMode::Udp);
        assert_eq!(config.diff_mode(), DiffMode::StateSync);
        Ok(())
    }

    #[test]
    fn explicit_datagram_honored_over_tcp() -> Result<()> {
        let toml = r#"
            private_key_path = "/tmp/priv"
            public_key_path = "/tmp/pub"
            transport = "tcp"
            diff_mode = "datagram"
        "#;
        let config: Config = toml::from_str(toml)?;
        assert_eq!(config.diff_mode(), DiffMode::Datagram);
        Ok(())
    }

    #[test]
    fn test_default_config() {
        let config = Config::default();
        assert_eq!(config.mode(), KexMode::Client);
        assert_eq!(config.server_port(), 40404);
        assert_eq!(config.server_destination(), "");
        assert_eq!(config.private_key_path(), &None);
        assert_eq!(config.public_key_path(), &None);
        assert_eq!(config.resume_session_uuid(), None);
        assert_eq!(config.max_reconnect_backoff_secs(), 3600);
        assert_eq!(config.predict(), DisplayPreference::default());
        assert_eq!(config.escape_key(), "ctrl-^");
    }

    #[test]
    fn test_kex_config_impl() -> Result<()> {
        let mut config = Config::default();
        let _ = config.set_user("testuser".to_string());

        let uuid = Uuid::new_v4();
        let _ = config.set_resume_session_uuid(Some(uuid));

        assert_eq!(KexConfig::mode(&config), KexMode::Client);
        assert!(KexConfig::port_pool(&config).is_none());
        assert_eq!(
            KexConfig::user(&config).ok_or_else(|| anyhow::anyhow!("expected user to be set"))?,
            "testuser"
        );
        assert_eq!(KexConfig::resume_session_uuid(&config), Some(uuid));
        Ok(())
    }

    #[test]
    fn test_load_key_paths() -> Result<()> {
        // Without explicit paths, it should fall back to default
        let config = Config::default();
        let (priv_path, pub_path) = config.load_key_paths()?;
        assert!(priv_path.to_string_lossy().contains("id_x25519"));
        assert!(pub_path.to_string_lossy().contains("id_x25519.pub"));

        // With explicit paths
        let config = Config {
            private_key_path: Some("/tmp/my_priv".to_string()),
            public_key_path: Some("/tmp/my_pub".to_string()),
            ..Config::default()
        };
        let (priv_path, pub_path) = config.load_key_paths()?;
        assert_eq!(priv_path, PathBuf::from("/tmp/my_priv"));
        assert_eq!(pub_path, PathBuf::from("/tmp/my_pub"));
        Ok(())
    }
}