mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-30 01:06:08 +03:00
Chore: fix code style
This commit is contained in:
parent
ecbe222a50
commit
ecfb339680
@ -11,5 +11,6 @@ import (
|
|||||||
_ "cfa/native/tunnel"
|
_ "cfa/native/tunnel"
|
||||||
|
|
||||||
_ "golang.org/x/sync/semaphore"
|
_ "golang.org/x/sync/semaphore"
|
||||||
|
|
||||||
_ "github.com/Dreamacro/clash/log"
|
_ "github.com/Dreamacro/clash/log"
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
app2 "cfa/native/app"
|
"cfa/native/app"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/Dreamacro/clash/component/dialer"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ func openUrl(url string) (io.ReadCloser, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
request.Header.Set("User-Agent", "ClashForAndroid/"+app2.VersionName())
|
request.Header.Set("User-Agent", "ClashForAndroid/"+app.VersionName())
|
||||||
|
|
||||||
response, err := client.Do(request)
|
response, err := client.Do(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -50,7 +50,7 @@ func openUrl(url string) (io.ReadCloser, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func openContent(url string) (io.ReadCloser, error) {
|
func openContent(url string) (io.ReadCloser, error) {
|
||||||
return app2.OpenContent(url)
|
return app.OpenContent(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetch(url *U.URL, file string) error {
|
func fetch(url *U.URL, file string) error {
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"cfa/blob"
|
"cfa/blob"
|
||||||
|
|
||||||
app2 "cfa/native/app"
|
"cfa/native/app"
|
||||||
"cfa/native/platform"
|
"cfa/native/platform"
|
||||||
"github.com/Dreamacro/clash/component/process"
|
"github.com/Dreamacro/clash/component/process"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
@ -21,8 +21,8 @@ var errBlocked = errors.New("blocked")
|
|||||||
func Init(home, versionName string, platformVersion int) {
|
func Init(home, versionName string, platformVersion int) {
|
||||||
mmdb.LoadFromBytes(blob.GeoipDatabase)
|
mmdb.LoadFromBytes(blob.GeoipDatabase)
|
||||||
constant.SetHomeDir(home)
|
constant.SetHomeDir(home)
|
||||||
app2.ApplyVersionName(versionName)
|
app.ApplyVersionName(versionName)
|
||||||
app2.ApplyPlatformVersion(platformVersion)
|
app.ApplyPlatformVersion(platformVersion)
|
||||||
|
|
||||||
process.DefaultPackageNameResolver = func(metadata *constant.Metadata) (string, error) {
|
process.DefaultPackageNameResolver = func(metadata *constant.Metadata) (string, error) {
|
||||||
src, dst := metadata.RawSrcAddr, metadata.RawDstAddr
|
src, dst := metadata.RawSrcAddr, metadata.RawDstAddr
|
||||||
@ -31,8 +31,8 @@ func Init(home, versionName string, platformVersion int) {
|
|||||||
return "", process.ErrInvalidNetwork
|
return "", process.ErrInvalidNetwork
|
||||||
}
|
}
|
||||||
|
|
||||||
uid := app2.QuerySocketUid(metadata.RawSrcAddr, metadata.RawDstAddr)
|
uid := app.QuerySocketUid(metadata.RawSrcAddr, metadata.RawDstAddr)
|
||||||
pkg := app2.QueryAppByUid(uid)
|
pkg := app.QueryAppByUid(uid)
|
||||||
|
|
||||||
log.Debugln("[PKG] %s --> %s by %d[%s]", metadata.SourceAddress(), metadata.RemoteAddress(), uid, pkg)
|
log.Debugln("[PKG] %s --> %s by %d[%s]", metadata.SourceAddress(), metadata.RemoteAddress(), uid, pkg)
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ func Init(home, versionName string, platformVersion int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return conn.Control(func(fd uintptr) {
|
return conn.Control(func(fd uintptr) {
|
||||||
app2.MarkSocket(int(fd))
|
app.MarkSocket(int(fd))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user