Why do browsers block some ports?

前端 未结 3 1867
予麋鹿
予麋鹿 2020-12-09 18:03

I\'m playing around with websockets and it appears, that all browsers with native websocket support I tested with (Safari, Chrome) block some ports. If I try to connect to m

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 18:46

    To add a fresh list to the old question:

    https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc

    // The general list of blocked ports. Will be blocked unless a specific
    // protocol overrides it. (Ex: ftp can use ports 20 and 21)
    const int kRestrictedPorts[] = {
        1,       // tcpmux
        7,       // echo
        9,       // discard
        11,      // systat
        13,      // daytime
        15,      // netstat
        17,      // qotd
        19,      // chargen
        20,      // ftp data
        21,      // ftp access
        22,      // ssh
        23,      // telnet
        25,      // smtp
        37,      // time
        42,      // name
        43,      // nicname
        53,      // domain
        77,      // priv-rjs
        79,      // finger
        87,      // ttylink
        95,      // supdup
        101,     // hostriame
        102,     // iso-tsap
        103,     // gppitnp
        104,     // acr-nema
        109,     // pop2
        110,     // pop3
        111,     // sunrpc
        113,     // auth
        115,     // sftp
        117,     // uucp-path
        119,     // nntp
        123,     // NTP
        135,     // loc-srv /epmap
        139,     // netbios
        143,     // imap2
        179,     // BGP
        389,     // ldap
        427,     // SLP (Also used by Apple Filing Protocol)
        465,     // smtp+ssl
        512,     // print / exec
        513,     // login
        514,     // shell
        515,     // printer
        526,     // tempo
        530,     // courier
        531,     // chat
        532,     // netnews
        540,     // uucp
        548,     // AFP (Apple Filing Protocol)
        556,     // remotefs
        563,     // nntp+ssl
        587,     // smtp (rfc6409)
        601,     // syslog-conn (rfc3195)
        636,     // ldap+ssl
        993,     // ldap+ssl
        995,     // pop3+ssl
        2049,    // nfs
        3659,    // apple-sasl / PasswordServer
        4045,    // lockd
        6000,    // X11
        6665,    // Alternate IRC [Apple addition]
        6666,    // Alternate IRC [Apple addition]
        6667,    // Standard IRC [Apple addition]
        6668,    // Alternate IRC [Apple addition]
        6669,    // Alternate IRC [Apple addition]
        6697,    // IRC + TLS
    };
    

提交回复
热议问题