-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathassertOverwrite.go
More file actions
30 lines (25 loc) · 797 Bytes
/
assertOverwrite.go
File metadata and controls
30 lines (25 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package libv2ray
var overridedAssets map[string](string)
/*SetAssetsOverride will define file path @[data] to
provide the asset named @[path].
SetAssetsOverride("geoip.dat","/data/data/appdir/dat/geoip-override.dat")
will ask libv2ray to serve v2ray "geoip.dat" with
file "/data/data/appdir/dat/geoip-override.dat" in file system
*/
func SetAssetsOverride(path string, data string) {
if overridedAssets == nil {
overridedAssets = make(map[string](string))
}
overridedAssets[path] = data
}
/*ClearAssetsOverride can disable an override
at given @[path].
ClearAssetsOverride("geoip.dat")
will ask libv2ray to serve vanilla asset file.
*/
func ClearAssetsOverride(path string) {
if overridedAssets == nil {
overridedAssets = make(map[string](string))
}
delete(overridedAssets, path)
}