Add DHCP DNS server support

This commit is contained in:
世界 2023-02-08 16:28:52 +08:00
parent df3a982141
commit 7ea9d48987
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
12 changed files with 427 additions and 38 deletions

5
include/dhcp.go Normal file
View file

@ -0,0 +1,5 @@
//go:build with_dhcp
package include
import _ "github.com/sagernet/sing-box/transport/dhcp"

18
include/dhcp_stub.go Normal file
View file

@ -0,0 +1,18 @@
//go:build !with_dhcp
package include
import (
"context"
"github.com/sagernet/sing-dns"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/logger"
N "github.com/sagernet/sing/common/network"
)
func init() {
dns.RegisterTransport([]string{"dhcp"}, func(ctx context.Context, logger logger.ContextLogger, dialer N.Dialer, link string) (dns.Transport, error) {
return nil, E.New(`DHCP is not included in this build, rebuild with -tags with_dhcp`)
})
}