mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 11:29:36 +03:00
DNS Header for KCP (#1672)
* dns header * fixed domain name encoding for dns header --------- Co-authored-by: kerry <lvhaiyangkerry@gmail.com>
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"sort"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/dns"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/http"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/noop"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/srtp"
|
||||
@ -49,6 +50,19 @@ func (WireguardAuthenticator) Build() (proto.Message, error) {
|
||||
return new(wireguard.WireguardConfig), nil
|
||||
}
|
||||
|
||||
type DNSAuthenticator struct {
|
||||
Domain string `json:"domain"`
|
||||
}
|
||||
|
||||
func (v *DNSAuthenticator) Build() (proto.Message, error) {
|
||||
config := new(dns.Config)
|
||||
config.Domain = "www.baidu.com"
|
||||
if len(v.Domain) > 0 {
|
||||
config.Domain = v.Domain
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
type DTLSAuthenticator struct{}
|
||||
|
||||
func (DTLSAuthenticator) Build() (proto.Message, error) {
|
||||
|
@ -37,6 +37,7 @@ var (
|
||||
"wechat-video": func() interface{} { return new(WechatVideoAuthenticator) },
|
||||
"dtls": func() interface{} { return new(DTLSAuthenticator) },
|
||||
"wireguard": func() interface{} { return new(WireguardAuthenticator) },
|
||||
"dns": func() interface{} { return new(DNSAuthenticator) },
|
||||
}, "type", "")
|
||||
|
||||
tcpHeaderLoader = NewJSONConfigLoader(ConfigCreatorCache{
|
||||
|
Reference in New Issue
Block a user