mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
714e182096
commit
3f94d26ca4
4 changed files with 47 additions and 3 deletions
|
@ -258,6 +258,24 @@ void srs_parse_endpoint(string hostport, string& ip, int& port)
|
|||
}
|
||||
}
|
||||
|
||||
bool srs_check_ip_addr_valid(string ip)
|
||||
{
|
||||
unsigned char buf[sizeof(struct in6_addr)];
|
||||
|
||||
// check ipv4
|
||||
int ret = inet_pton(AF_INET, ip.data(), buf);
|
||||
if (ret > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ret = inet_pton(AF_INET6, ip.data(), buf);
|
||||
if (ret > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
string srs_int2str(int64_t value)
|
||||
{
|
||||
// len(max int64_t) is 20, plus one "+-."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue