Skip to content

Commit 4327e6e

Browse files
authored
refactor(ice): replace magic numbers with named constants for STUN/TURN ports (#697)
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
1 parent c4f8623 commit 4327e6e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ice/src/url/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ mod url_test;
44
use std::convert::From;
55
use std::fmt;
66

7+
use stun::{DEFAULT_PORT, DEFAULT_TLS_PORT};
8+
79
use crate::error::*;
810

911
/// The type of server used in the ice.URL structure.
@@ -165,9 +167,9 @@ impl Url {
165167
let port = if let Some(port) = raw_parts.port() {
166168
port
167169
} else if scheme == SchemeType::Stun || scheme == SchemeType::Turn {
168-
3478
170+
DEFAULT_PORT
169171
} else {
170-
5349
172+
DEFAULT_TLS_PORT
171173
};
172174

173175
let mut q_args = raw_parts.query_pairs();

0 commit comments

Comments
 (0)