mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-08-12 05:17:36 +08:00
Fix libresolv initialization
Fixes: 9533031891c0 ("Update libresolv usage") Signed-off-by: Youfu Zhang <zhangyoufu@gmail.com>
This commit is contained in:
parent
9495b56772
commit
fba802effd
@ -20,8 +20,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func dnsReadConfig(_ context.Context, _ string) *dnsConfig {
|
func dnsReadConfig(_ context.Context, _ string) *dnsConfig {
|
||||||
var state C.res_state
|
var state C.struct___res_state
|
||||||
if C.res_ninit(state) != 0 {
|
if C.res_ninit(&state) != 0 {
|
||||||
return &dnsConfig{
|
return &dnsConfig{
|
||||||
servers: defaultNS,
|
servers: defaultNS,
|
||||||
search: dnsDefaultSearch(),
|
search: dnsDefaultSearch(),
|
||||||
|
13
dns/transport/local/resolv_test.go
Normal file
13
dns/transport/local/resolv_test.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package local
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDNSReadConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
require.NoError(t, dnsReadConfig(context.Background(), "/etc/resolv.conf").err)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user