Skip to content

Commit

Permalink
Change Stun server URLs to the correct ones for WebRTC service (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
klejejs authored Oct 1, 2024
1 parent 5552c7a commit 85f1a28
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/services/webrtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ interface StunDomainRoutingConfig {
}

const STUN_DOMAINS = {
"us-east-1": "stun:44.197.212.58:3478",
"eu-central-1": "stun:44.197.212.58:3478",
"ap-southeast-1": "stun:44.197.212.58:3478",
"us-east-1": "stun:stun-us-east-1.home-assistant.io:3478",
"eu-central-1": "stun:stun-eu-central-1.home-assistant.io:3478",
"ap-southeast-1": "stun:stun-ap-southeast-1.home-assistant.io:3478",
};

const STUN_DOMAIN_ROUTING_CONFIG: StunDomainRoutingConfig = {
Expand Down
24 changes: 18 additions & 6 deletions tests/webrtc.handler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@ describe("WebRTC Handler", () => {
});

for (const [country, continent, expected] of [
["NO_CUSTOM_CONFIG", "NO_CUSTOM_CONFIG", "stun:44.197.212.58:3478"],
["IL", "NOT_USED", "stun:44.197.212.58:3478"],
["LB", "NOT_USED", "stun:44.197.212.58:3478"],
["NO_CUSTOM_CONFIG", "EU", "stun:44.197.212.58:3478"],
["NO_CUSTOM_CONFIG", "AS", "stun:44.197.212.58:3478"],
["NO_CUSTOM_CONFIG", "OC", "stun:44.197.212.58:3478"],
[
"NO_CUSTOM_CONFIG",
"NO_CUSTOM_CONFIG",
"stun:stun-us-east-1.home-assistant.io:3478",
],
["IL", "NOT_USED", "stun:stun-eu-central-1.home-assistant.io:3478"],
["LB", "NOT_USED", "stun:stun-eu-central-1.home-assistant.io:3478"],
["NO_CUSTOM_CONFIG", "EU", "stun:stun-eu-central-1.home-assistant.io:3478"],
[
"NO_CUSTOM_CONFIG",
"AS",
"stun:stun-ap-southeast-1.home-assistant.io:3478",
],
[
"NO_CUSTOM_CONFIG",
"OC",
"stun:stun-ap-southeast-1.home-assistant.io:3478",
],
]) {
it(`returns correct domains for country ${country} and continent ${continent}`, async () => {
MockEvent.request.cf.country = country;
Expand Down

0 comments on commit 85f1a28

Please sign in to comment.