Skip to content

Commit

Permalink
Merge pull request #12 from tony-cloud/tc-feat-logged-in-only
Browse files Browse the repository at this point in the history
feat: control end need to login before access sctg-development/sctgdesk-api-server#14
  • Loading branch information
aeltorio authored Oct 11, 2024
2 parents a2bebeb + 68586d6 commit 8f44bf7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/rendezvous_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,18 @@ impl RendezvousServer {
});
return Ok((msg_out, None));
}
if ph.token.is_empty() && std::env::var("LOGGED_IN_ONLY")
.unwrap_or_default()
.to_uppercase()
== "Y"
{
let mut msg_out = RendezvousMessage::new();
msg_out.set_punch_hole_response(PunchHoleResponse {
other_failure: String::from("The connection is not allowed. You have not logged in."),
..Default::default()
});
return Ok((msg_out, None));
}
let id = ph.id;
// punch hole request from A, relay to B,
// check if in same intranet first,
Expand Down

0 comments on commit 8f44bf7

Please # to comment.