Skip to content

Commit

Permalink
set INADDR_ANY
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaarey committed Aug 20, 2024
1 parent 86d1c1a commit 976118d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All files from anonymous, No need for an Android emulator to decrypt alac
### 安装
推荐Windows Subsystem for Linux (WSL)使用
usage: `./wrapper [port] ([username] [password])`
get-m3u8为port+10000

```shell
sudo -i
Expand Down
8 changes: 4 additions & 4 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ inline static int new_socket() {
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval));

static struct sockaddr_in serv_addr = {.sin_family = AF_INET};
serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(port);
if (bind(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == -1) {
perror("bind");
Expand All @@ -389,7 +389,7 @@ inline static int new_socket() {
return EXIT_FAILURE;
}

fprintf(stderr, "[!] listening 127.0.0.1:%d\n", port);
fprintf(stderr, "[!] listening 0.0.0.0:%d\n", port);
close(STDOUT_FILENO);

static struct sockaddr_in peer_addr;
Expand Down Expand Up @@ -481,7 +481,7 @@ static inline void *new_socket_m3u8(void *args) {
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval));

static struct sockaddr_in serv_addr = {.sin_family = AF_INET};
serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(m3u8_port);
if (bind(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == -1) {
perror("bind");
Expand All @@ -491,7 +491,7 @@ static inline void *new_socket_m3u8(void *args) {
perror("listen");
}

fprintf(stderr, "[!] listening m3u8 request on 127.0.0.1:%d\n", m3u8_port);
fprintf(stderr, "[!] listening m3u8 request on 0.0.0.0:%d\n", m3u8_port);
close(STDOUT_FILENO);

static struct sockaddr_in peer_addr;
Expand Down

0 comments on commit 976118d

Please sign in to comment.