Fix const coding style

This commit is contained in:
klzgrad 2021-04-17 18:42:45 +08:00
parent c2e8c4676e
commit a7dbb5a086
2 changed files with 14 additions and 23 deletions

View File

@ -20,14 +20,20 @@
namespace net { namespace net {
const unsigned int Socks5ServerSocket::kGreetReadHeaderSize = 2; enum SocksCommandType {
const unsigned int Socks5ServerSocket::kReadHeaderSize = 5; kCommandConnect = 0x01,
const char Socks5ServerSocket::kSOCKS5Version = '\x05'; kCommandBind = 0x02,
const char Socks5ServerSocket::kSOCKS5Reserved = '\x00'; kCommandUDPAssociate = 0x03,
const char Socks5ServerSocket::kAuthMethodNone = '\x00'; };
const char Socks5ServerSocket::kAuthMethodNoAcceptable = '\xff';
const char Socks5ServerSocket::kReplySuccess = '\x00'; static constexpr unsigned int kGreetReadHeaderSize = 2;
const char Socks5ServerSocket::kReplyCommandNotSupported = '\x07'; static constexpr unsigned int kReadHeaderSize = 5;
static constexpr char kSOCKS5Version = '\x05';
static constexpr char kSOCKS5Reserved = '\x00';
static constexpr char kAuthMethodNone = '\x00';
static constexpr char kAuthMethodNoAcceptable = '\xff';
static constexpr char kReplySuccess = '\x00';
static constexpr char kReplyCommandNotSupported = '\x07';
static_assert(sizeof(struct in_addr) == 4, "incorrect system size of IPv4"); static_assert(sizeof(struct in_addr) == 4, "incorrect system size of IPv4");
static_assert(sizeof(struct in6_addr) == 16, "incorrect system size of IPv6"); static_assert(sizeof(struct in6_addr) == 16, "incorrect system size of IPv6");

View File

@ -92,21 +92,6 @@ class Socks5ServerSocket : public StreamSocket {
kEndPointResolvedIPv6 = 0x04, kEndPointResolvedIPv6 = 0x04,
}; };
enum SocksCommandType {
kCommandConnect = 0x01,
kCommandBind = 0x02,
kCommandUDPAssociate = 0x03,
};
static const unsigned int kGreetReadHeaderSize;
static const unsigned int kReadHeaderSize;
static const char kSOCKS5Version;
static const char kSOCKS5Reserved;
static const char kAuthMethodNone;
static const char kAuthMethodNoAcceptable;
static const char kReplySuccess;
static const char kReplyCommandNotSupported;
void DoCallback(int result); void DoCallback(int result);
void OnIOComplete(int result); void OnIOComplete(int result);
void OnReadWriteComplete(CompletionOnceCallback callback, int result); void OnReadWriteComplete(CompletionOnceCallback callback, int result);