Heray-Was-Here
Server : Apache
System : Linux vps43555.mylogin.co 3.10.0-1160.53.1.vz7.185.3 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64
User : redsea ( 60651)
PHP Version : 7.4.32
Disable Function : NONE
Directory :  /proc/2/cwd/proc/self/root/lib/node_modules/socket.io/node_modules/uws/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/2/cwd/proc/self/root/lib/node_modules/socket.io/node_modules/uws/src/Socket.cpp
#include "Socket.h"

namespace uS {

Socket::Address Socket::getAddress()
{
    uv_os_sock_t fd = getFd();

    sockaddr_storage addr;
    socklen_t addrLength = sizeof(addr);
    if (getpeername(fd, (sockaddr *) &addr, &addrLength) == -1) {
        return {0, "", ""};
    }

    static __thread char buf[INET6_ADDRSTRLEN];

    if (addr.ss_family == AF_INET) {
        sockaddr_in *ipv4 = (sockaddr_in *) &addr;
        inet_ntop(AF_INET, &ipv4->sin_addr, buf, sizeof(buf));
        return {ntohs(ipv4->sin_port), buf, "IPv4"};
    } else {
        sockaddr_in6 *ipv6 = (sockaddr_in6 *) &addr;
        inet_ntop(AF_INET6, &ipv6->sin6_addr, buf, sizeof(buf));
        return {ntohs(ipv6->sin6_port), buf, "IPv6"};
    }
}

}

Hry