瀏覽代碼

优化修改代码

niujiuru 1 月之前
父節點
當前提交
83f032fa95
共有 1 個文件被更改,包括 6 次插入1 次删除
  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() {