-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed local ip lookup on macOS GitHub instances.
myIpAddress() and myIpAddressEx should be enumerating the network interfaces and returning the local addresses with getifaddrs/GetAdapterAddresses. Where as, dnsResolve() and dnsResolveEx() enumerates resolved host names using getaddrinfo.
- Loading branch information
Showing
5 changed files
with
466 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// Resolve a host name to it an IPv4 address | ||
char *dns_resolve(const char *host, int32_t *error); | ||
|
||
// Resolve a host name to its addresses | ||
char *dns_resolve_ex(const char *host, int32_t *error); | ||
|
||
// Check if the ipv4 address matches the cidr notation range | ||
bool is_ipv4_in_cidr_range(const char *ip, const char *cidr); | ||
|
||
// Check if the ipv6 address matches the cidr notation range | ||
bool is_ipv6_in_cidr_range(const char *ip, const char *cidr); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// Get local IPv4 address for localhost | ||
char *my_ip_address(void); | ||
|
||
// Get local IPv6 and IPv6 addresses for localhost | ||
char *my_ip_address_ex(void); | ||
|
||
// Resolve a host name to it an IPv4 address | ||
char *dns_resolve(const char *host, int32_t *error); | ||
|
||
// Resolve a host name to its IPv6 and IPv6 addresses | ||
char *dns_resolve_ex(const char *host, int32_t *error); | ||
|
||
// Check if the ipv4 address matches the cidr notation range | ||
bool is_ipv4_in_cidr_range(const char *ip, const char *cidr); | ||
|
||
// Check if the ipv6 address matches the cidr notation range | ||
bool is_ipv6_in_cidr_range(const char *ip, const char *cidr); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.