Skip to content

Commit

Permalink
holepunch: add bind_ip option
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiatka committed Oct 6, 2023
1 parent f2ac2cb commit a1ac44a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,12 @@ static void copy_sv_to_c_buf(char (&dest)[N], std::string_view sv){

if(key == "help"){
col() << "Usage:\n" <<
"\tuv " << TBOLD("-Nholepunch:room=<room>:(server=<host> | coord_srv=<host:port>:stun_srv=<host:port>)[:client_name=<name>] \n") <<
"\tuv " << TBOLD("-Nholepunch:room=<room>:(server=<host> | coord_srv=<host:port>:stun_srv=<host:port>)[:client_name=<name>][:bind_ip=<addr>] \n") <<
"\twhere\n"
"\t\t" << TBOLD("server") << " - used if both stun & coord server are on the same host on standard ports (3478, 12558)\n"
"\t\t" << TBOLD("room") << " - name of room to join\n"
"\t\t" << TBOLD("client_name") << " - name to identify as to the coord server, if not specified hostname is used\n"
"\t\t" << TBOLD("bind_ip") << " - local ip to bind to\n"
"\n";
return false;
}
Expand Down Expand Up @@ -507,6 +508,8 @@ static void copy_sv_to_c_buf(char (&dest)[N], std::string_view sv){
copy_sv_to_c_buf(punch_c->room_name, val);
} else if(key == "client_name"){
copy_sv_to_c_buf(punch_c->client_name, val);
} else if(key == "bind_ip"){
copy_sv_to_c_buf(punch_c->bind_addr, val);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/udp_holepunch.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct Holepunch_config{
char *host_addr;
size_t host_addr_len;

const char *bind_addr;
char bind_addr[64];

char coord_srv_addr[512];
int coord_srv_port;
Expand Down

0 comments on commit a1ac44a

Please sign in to comment.