mirror of https://github.com/bjdgyc/anylink.git
fix
This commit is contained in:
parent
17492d8172
commit
638a99275e
|
@ -28,6 +28,10 @@ var (
|
|||
logName = "anylink.log"
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||
}
|
||||
|
||||
// 实现 os.Writer 接口
|
||||
type logWriter struct {
|
||||
UseStdout bool
|
||||
|
|
|
@ -50,20 +50,25 @@ func CheckModOrLoad(mod string) {
|
|||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
if mod == "tun" || mod == "tap" {
|
||||
_, err := os.Stat(tunPath)
|
||||
_, err = os.Stat(tunPath)
|
||||
if err == nil {
|
||||
// 文件存在
|
||||
return
|
||||
}
|
||||
panic("Linux tunFile is null " + tunPath)
|
||||
err = fmt.Errorf("Linux tunFile is null %s", tunPath)
|
||||
log.Println(err)
|
||||
return
|
||||
// panic(err)
|
||||
}
|
||||
|
||||
if InContainer {
|
||||
err := fmt.Errorf("Linux module %s is not loaded, please run `modprobe %s`", mod, mod)
|
||||
// log.Println(err)
|
||||
// return
|
||||
panic(err)
|
||||
err = fmt.Errorf("Linux module %s is not loaded, please run `modprobe %s`", mod, mod)
|
||||
log.Println(err)
|
||||
return
|
||||
// panic(err)
|
||||
}
|
||||
|
||||
cmdstr := fmt.Sprintln("modprobe", mod)
|
||||
|
|
Loading…
Reference in New Issue