Explorar el Código

优化修改代码

niujiuru hace 1 mes
padre
commit
83f032fa95
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      netmgrd/netmgrd.go

+ 6 - 1
netmgrd/netmgrd.go

@@ -19,11 +19,11 @@ var (
 	isOnline        atomic.Bool  // 标记是否联网
 	offlineStartTs  atomic.Int64 // 离线开始时间
 	isSyncNTPTimeOK atomic.Bool  // 标记本地时间是否已同步成功
+	curNetType      NetType      // 当前的网络类型: 有线、蜂窝
 	mu1             sync.Mutex
 	isRunning1      bool
 	exitCh1         chan struct{}
 	wg1             sync.WaitGroup
-	curNetType      NetType
 )
 
 type NetType int
@@ -305,6 +305,11 @@ func monitorEth0PlugCycle(plugCycle chan bool, done chan struct{}) error {
 	}
 }
 
+// 得到当前联网类型: 有线、蜂窝
+func GetCurrentNetType() NetType {
+	return curNetType
+}
+
 //export RTU_IsInetAvailable
 func RTU_IsInetAvailable() C.int {
 	if IsInetAvailable() {