chore: Cleanup code

This commit is contained in:
H1JK
2023-11-17 23:12:10 +08:00
parent fef5ad780d
commit 1479b449df
32 changed files with 77 additions and 56 deletions

View File

@@ -2,6 +2,4 @@
package features
func init() {
TAGS = append(TAGS, "cmfa")
}
const CMFA = true

View File

@@ -0,0 +1,5 @@
//go:build !cmfa
package features
const CMFA = false

View File

@@ -2,6 +2,4 @@
package features
func init() {
TAGS = append(TAGS, "with_low_memory")
}
const WithLowMemory = true

View File

@@ -0,0 +1,5 @@
//go:build !with_low_memory
package features
const WithLowMemory = false

View File

@@ -2,6 +2,4 @@
package features
func init() {
TAGS = append(TAGS, "no_fake_tcp")
}
const NoFakeTCP = true

View File

@@ -0,0 +1,5 @@
//go:build !no_fake_tcp
package features
const NoFakeTCP = false

View File

@@ -1,11 +1,17 @@
package features
import(
"golang.org/x/exp/slices"
)
var TAGS = make([]string, 0, 0)
func Contains(feat string) (bool) {
return slices.Contains(TAGS, feat)
}
func Tags() (tags []string) {
if CMFA {
tags = append(tags, "cmfa")
}
if WithLowMemory {
tags = append(tags, "with_low_memory")
}
if NoFakeTCP {
tags = append(tags, "no_fake_tcp")
}
if WithGVisor {
tags = append(tags, "with_gvisor")
}
return
}

View File

@@ -2,6 +2,4 @@
package features
func init() {
TAGS = append(TAGS, "with_gvisor")
}
const WithGVisor = true

View File

@@ -0,0 +1,5 @@
//go:build !with_gvisor
package features
const WithGVisor = false