Skip to content

Commit

Permalink
use krelay for tunneling
Browse files Browse the repository at this point in the history
  • Loading branch information
miroberts authored and aaunario-keeper committed Mar 11, 2024
1 parent 45406a3 commit ef83680
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions keepercommander/commands/tunnel/port_forward/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class WebRTCConnection:
def __init__(self, endpoint_name: str, params: KeeperParams, record_uid, gateway_uid, symmetric_key,
print_ready_event: asyncio.Event, kill_server_event: asyncio.Event,
logger: Optional[logging.Logger] = None, server='keepersecurity.com'):
self.relay_url = None

self._pc = None
self.web_rtc_queue = asyncio.Queue()
self.closed = False
Expand All @@ -173,7 +173,12 @@ def __init__(self, endpoint_name: str, params: KeeperParams, record_uid, gateway
self.gateway_uid = gateway_uid
self.symmetric_key = symmetric_key
self.kill_server_event = kill_server_event
self.server = server
# Using Keeper's STUN and TURN servers
self.relay_url = 'krelay.' + server
krelay_url = os.getenv(KRELAY_URL)
if krelay_url:
self.relay_url = krelay_url
self.logger.debug(f'Using relay server: {self.relay_url}')
try:
self.peer_ice_config()
self.setup_data_channel()
Expand Down Expand Up @@ -272,12 +277,6 @@ async def signal_channel(self, kind: str):

def peer_ice_config(self):
response = router_get_relay_access_creds(params=self.params, expire_sec=60000000)
# Using Keeper's STUN and TURN servers
self.relay_url = 'krelay.' + self.server
krelay_url = os.getenv(KRELAY_URL)
if krelay_url:
self.relay_url = krelay_url
self.logger.debug(f'Using relay server: {self.relay_url}')
stun_url = f"stun:{self.relay_url}:3478"
# Create an RTCIceServer instance for the STUN server
stun_server = RTCIceServer(urls=stun_url)
Expand Down

0 comments on commit ef83680

Please sign in to comment.