Fakedns fix xUDP destination override (#1011)

* Fix UDP destination override

* Fix code style

* Fix fakedns object init

Do type convertion at runtime in case if user don't use fakedns in config.
Since dispatcher now depend on fakedns object, move the injection order of
fakedns to top (As a temporary solution)

* Amend logic for handing fakedns client

A map is used by server side when client turn on fakedns
Client will send domain address in the buffer.UDP.Address, server record all possible target IP addrs.
When target replies, server will restore the domain and send back to client.

Co-authored-by: hmol233 <82594500+hmol233@users.noreply.github.com>
This commit is contained in:
yuhan6665 2022-04-23 19:24:46 -04:00 committed by GitHub
parent c9df755426
commit b413066012
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 24 deletions

View file

@ -632,7 +632,7 @@ func (c *Config) Build() (*core.Config, error) {
if err != nil {
return nil, err
}
config.App = append(config.App, serial.ToTypedMessage(r))
config.App = append([]*serial.TypedMessage{serial.ToTypedMessage(r)}, config.App...)
}
if c.Observatory != nil {