Skip to content

Commit

Permalink
feat(comm): add resolve type enums
Browse files Browse the repository at this point in the history
  • Loading branch information
outman-zhou committed Mar 28, 2024
1 parent 56fe031 commit 1e0ea87
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions mars/comm/comm_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
// Created by garry on 2017/2/17.
//

#ifndef comm_data_h
#define comm_data_h

#include <stdint.h>
#ifndef mars_comm_data_h
#define mars_comm_data_h

#include <cstdint>
#include <string>

namespace mars {
namespace comm {

// proxy
enum ProxyType {
kProxyNone = 0,
kProxyHttpTunel,
Expand Down Expand Up @@ -75,7 +75,7 @@ class ProxyInfo {
std::string password;
};

//
// connect records
enum class BizType { CGI = 0, CDN, COUNT };
enum class ProtoType { TCP = 0, QUIC, COUNT };

Expand All @@ -91,7 +91,33 @@ inline bool operator<(const ConnRecord& lhs, const ConnRecord& rhs) {
return lhs.begin_timestamp_ms < rhs.begin_timestamp_ms;
}

// host resolve
enum EResolveHostPriority {
PRIORITY_NEWDNS_FIRST = 0, // newdns 优先.
PRIORITY_SIMPLEDNS_FIRST, // simpledns优先
};

enum EResolveHostFlag {
FLAG_TRY_NEWDNS = 1,
FLAG_TRY_SIMPLEDNS = 1 << 1,
FLAG_TRY_LOCALDNS = 1 << 2,

FLAGS_NEWDNS_DEFAULT = FLAG_TRY_NEWDNS | FLAG_TRY_LOCALDNS,
FLAGS_SIMPLEDNS_DEFAULT = FLAG_TRY_SIMPLEDNS | FLAG_TRY_LOCALDNS,
FLAGS_ALLINONE = FLAG_TRY_NEWDNS | FLAG_TRY_SIMPLEDNS | FLAG_TRY_LOCALDNS,
FLAGS_ALL_WITHOUT_LOCALDNS = FLAG_TRY_NEWDNS | FLAG_TRY_SIMPLEDNS,
};

enum EHostType {
kHostNone = 0,
kHostFromNewDNS = 1,
kHostFromSysDNS = 2,
kHostFromDebugIP = 3,
kHostFromSimpleDNS = 4,
kHostFromLiteral = 5,
};

} // namespace comm
} // namespace mars

#endif /* comm_data_h */
#endif /* mars_comm_data_h */

0 comments on commit 1e0ea87

Please sign in to comment.