1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-09 01:10:44 +00:00
v2fly/app/dns/config.proto

228 lines
5.8 KiB
Protocol Buffer
Raw Normal View History

2016-09-20 14:05:35 +00:00
syntax = "proto3";
2016-09-26 13:14:16 +00:00
package v2ray.core.app.dns;
2016-12-22 23:24:28 +00:00
option csharp_namespace = "V2Ray.Core.App.Dns";
option go_package = "github.com/v2fly/v2ray-core/v5/app/dns";
2016-09-26 13:14:16 +00:00
option java_package = "com.v2ray.core.app.dns";
2017-02-03 22:15:10 +00:00
option java_multiple_files = true;
2016-09-20 14:05:35 +00:00
import "common/net/address.proto";
import "common/net/destination.proto";
import "app/router/routercommon/common.proto";
import "app/dns/fakedns/fakedns.proto";
2016-09-20 14:05:35 +00:00
import "common/protoext/extensions.proto";
message NameServer {
v2ray.core.common.net.Endpoint address = 1;
bytes client_ip = 5;
string tag = 7;
message PriorityDomain {
DomainMatchingType type = 1;
string domain = 2;
}
message OriginalRule {
string rule = 1;
uint32 size = 2;
}
repeated PriorityDomain prioritized_domain = 2;
repeated v2ray.core.app.router.routercommon.GeoIP geoip = 3;
repeated OriginalRule original_rules = 4;
v2ray.core.app.dns.fakedns.FakeDnsPoolMulti fake_dns = 11;
// Deprecated. Use fallback_strategy.
bool skipFallback = 6 [deprecated = true];
optional QueryStrategy query_strategy = 8;
optional CacheStrategy cache_strategy = 9;
optional FallbackStrategy fallback_strategy = 10;
}
enum DomainMatchingType {
Full = 0;
Subdomain = 1;
Keyword = 2;
2018-09-19 14:10:42 +00:00
Regex = 3;
}
enum QueryStrategy {
USE_IP = 0;
USE_IP4 = 1;
USE_IP6 = 2;
}
enum CacheStrategy {
CacheEnabled = 0;
CacheDisabled = 1;
}
enum FallbackStrategy {
Enabled = 0;
Disabled = 1;
DisabledIfAnyMatch = 2;
}
message HostMapping {
DomainMatchingType type = 1;
string domain = 2;
repeated bytes ip = 3;
// ProxiedDomain indicates the mapped domain has the same IP address on this
// domain. V2Ray will use this domain for IP queries.
string proxied_domain = 4;
}
2016-09-20 14:05:35 +00:00
message Config {
// Nameservers used by this DNS. Only traditional UDP servers are support at
// the moment. A special value 'localhost' as a domain address can be set to
// use DNS on local system.
repeated v2ray.core.common.net.Endpoint NameServers = 1 [deprecated = true];
// NameServer list used by this DNS client.
repeated NameServer name_server = 5;
2016-10-18 08:31:39 +00:00
// Static hosts. Domain to IP.
// Deprecated. Use static_hosts.
map<string, v2ray.core.common.net.IPOrDomain> Hosts = 2 [deprecated = true];
2018-06-26 15:14:51 +00:00
// Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes
// (IPv6).
2018-06-26 21:23:59 +00:00
bytes client_ip = 3;
// Static domain-ip mapping in DNS server.
repeated HostMapping static_hosts = 4;
// Global fakedns object.
v2ray.core.app.dns.fakedns.FakeDnsPoolMulti fake_dns = 16;
// Tag is the inbound tag of DNS client.
string tag = 6;
reserved 7;
// Domain matcher to use
string domain_matcher = 15;
// DisableCache disables DNS cache
// Deprecated. Use cache_strategy.
bool disableCache = 8 [deprecated = true];
// Deprecated. Use fallback_strategy.
bool disableFallback = 10 [deprecated = true];
// Deprecated. Use fallback_strategy.
bool disableFallbackIfMatch = 11 [deprecated = true];
// Default query strategy (IPv4, IPv6, or both) for each name server.
QueryStrategy query_strategy = 9;
// Default cache strategy for each name server.
CacheStrategy cache_strategy = 12;
2021-09-13 02:35:34 +00:00
// Default fallback strategy for each name server.
FallbackStrategy fallback_strategy = 13;
}
message SimplifiedConfig {
option (v2ray.core.common.protoext.message_opt).type = "service";
2021-09-07 07:05:18 +00:00
option (v2ray.core.common.protoext.message_opt).short_name = "dns";
// Nameservers used by this DNS. Only traditional UDP servers are support at
// the moment. A special value 'localhost' as a domain address can be set to
// use DNS on local system.
2021-09-10 19:35:02 +00:00
reserved 1;
// NameServer list used by this DNS client.
2021-09-10 19:35:02 +00:00
repeated SimplifiedNameServer name_server = 5;
// Static hosts. Domain to IP.
// Deprecated. Use static_hosts.
2021-09-10 19:35:02 +00:00
reserved 2;
// Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes
// (IPv6).
2021-09-10 19:35:02 +00:00
string client_ip = 3;
// Static domain-ip mapping in DNS server.
repeated SimplifiedHostMapping static_hosts = 4;
2019-01-16 19:32:41 +00:00
// Global fakedns object.
v2ray.core.app.dns.fakedns.FakeDnsPoolMulti fake_dns = 16;
2019-01-16 19:32:41 +00:00
// Tag is the inbound tag of DNS client.
string tag = 6;
Feature: Fake DNS support (#406) * Add fake dns A new config object "fake" in DnsObject for toggling fake dns function Compare with sniffing, fake dns is not limited to http and tls traffic. It works across all inbounds. For example, when dns request come from one inbound, the local DNS server of v2ray will response with a unique fake IP for every unique domain name. Then later on v2ray received a request to one of the fake IP from any inbounds, it will override the request destination with the previously saved domain. By default, v2ray cache up to 65535 addresses. The old records will be discarded bases on LRU. The fake IP will be 240.x.x.x * fix an edge case when encounter a fake IP in use * Move lru to common.cache package * Added the necessary change to obtain request IP from sniffer * Refactor the code so that it may stop depending on global variables in the future. * Replace string manipulation code with more generic codes, hopefully this will work for both IPv4 and IPv6 networks. * Try to use IPv4 version of address if possible * Added Test Case for Fake Dns * Added More Test Case for Fake Dns * Stop user from creating a instance with LRU size more than subnet size, it will create a infinite loop * Move Fake DNS to a separate package * Generated Code for fakedns * Encapsulate Fake DNS as a Instance wide service * Added Support for metadata sniffer, which will be used for Fake DNS * Dependency injection for fake dns * Fake DNS As a Sniffer * Remove stub object * Remove global variable * Update generated protobuf file for metadata only sniffing * Apply Fake DNS config to session * Loading for fake dns settings * Bug fix * Include fake dns in all * Fix FakeDns Lint Condition * Fix sniffer config * Fix lint message * Fix dependency resolution * Fix fake dns not loaded as sniffer * reduce ttl for fake dns * Apply Coding Style * Apply Coding Style * Apply Coding Style * Apply Coding Style * Apply Coding Style * Fix crashed when no fake dns * Apply Coding Style * Fix Fake DNS do not apply to UDP socket * Fixed a bug prevent FakeDNS App Setting from become effective * Fixed a caveat prevent FakeDNS App Setting from become effective * Use log comparison to reduce in issue when it comes to really high value typical for ipv6 subnet * Add build tag for fakedns * Removal of FakeDNS specific logic at DNS client: making it a standard dns client * Regenerate auto generated file * Amended version of configure file * Bug fixes for fakeDNS * Bug fixes for fakeDNS * Fix test: remove reference to removed attribute * Test: fix codacy issue * Conf: Remove old field support * Test: fix codacy issue * Change test scale for TestFakeDnsHolderCreateMappingAndRollOver * Test: fix codacy issue Co-authored-by: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Co-authored-by: kslr <kslrwang@gmail.com>
2021-02-08 10:18:52 +00:00
reserved 7;
// Domain matcher to use
string domain_matcher = 15;
// DisableCache disables DNS cache
// Deprecated. Use cache_strategy.
bool disableCache = 8 [deprecated = true];
// Deprecated. Use fallback_strategy.
bool disableFallback = 10 [deprecated = true];
// Deprecated. Use fallback_strategy.
bool disableFallbackIfMatch = 11 [deprecated = true];
// Default query strategy (IPv4, IPv6, or both) for each name server.
QueryStrategy query_strategy = 9;
// Default cache strategy for each name server.
CacheStrategy cache_strategy = 12;
2021-09-13 02:35:34 +00:00
// Default fallback strategy for each name server.
FallbackStrategy fallback_strategy = 13;
2016-09-20 14:05:35 +00:00
}
2021-09-10 19:35:02 +00:00
message SimplifiedHostMapping {
DomainMatchingType type = 1;
string domain = 2;
repeated string ip = 3;
// ProxiedDomain indicates the mapped domain has the same IP address on this
// domain. V2Ray will use this domain for IP queries.
string proxied_domain = 4;
}
message SimplifiedNameServer {
v2ray.core.common.net.Endpoint address = 1;
string client_ip = 5;
string tag = 7;
2021-09-10 19:35:02 +00:00
message PriorityDomain {
DomainMatchingType type = 1;
string domain = 2;
}
message OriginalRule {
string rule = 1;
uint32 size = 2;
}
repeated PriorityDomain prioritized_domain = 2;
repeated v2ray.core.app.router.routercommon.GeoIP geoip = 3;
repeated OriginalRule original_rules = 4;
v2ray.core.app.dns.fakedns.FakeDnsPoolMulti fake_dns = 11;
// Deprecated. Use fallback_strategy.
bool skipFallback = 6 [deprecated = true];
optional QueryStrategy query_strategy = 8;
optional CacheStrategy cache_strategy = 9;
optional FallbackStrategy fallback_strategy = 10;
repeated v2ray.core.app.router.routercommon.GeoSite geo_domain = 68001;
}