Add runtime warnings

This commit is contained in:
世界
2022-07-24 22:54:16 +08:00
parent 29c329dc52
commit 32e2730ec6
29 changed files with 677 additions and 16 deletions

View File

@@ -8,11 +8,11 @@ import (
"io"
"net"
"net/netip"
"runtime"
"sync"
"testing"
"time"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing/common/control"
F "github.com/sagernet/sing/common/format"
@@ -37,13 +37,10 @@ var allImages = []string{
ImageV2RayCore,
}
var (
localIP = netip.MustParseAddr("127.0.0.1")
isDarwin = runtime.GOOS == "darwin"
)
var localIP = netip.MustParseAddr("127.0.0.1")
func init() {
if isDarwin {
if C.IsDarwin {
var err error
localIP, err = defaultRouteIP()
if err != nil {

View File

@@ -5,6 +5,7 @@ import (
"testing"
"time"
C "github.com/sagernet/sing-box/constant"
F "github.com/sagernet/sing/common/format"
"github.com/docker/docker/api/types"
@@ -47,7 +48,7 @@ func startDockerContainer(t *testing.T, options DockerOptions) {
containerOptions.ExposedPorts = make(nat.PortSet)
var hostOptions container.HostConfig
if !isDarwin {
if !C.IsDarwin {
hostOptions.NetworkMode = "host"
}
hostOptions.PortBindings = make(nat.PortMap)