chore: remove selective loading bpf objects

This commit is contained in:
mzz2017
2023-02-27 09:56:00 +08:00
parent 7542884451
commit 8b59492fe5
6 changed files with 5 additions and 121 deletions

View File

@ -1,37 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) 2022-2023, v2rayA Organization <team@v2raya.org>
*/
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
)
func main() {
var output string
flag.StringVar(&output, "o", "", "Place the output into <file>.")
flag.Parse()
if output == "" {
fmt.Println("Please provide flag \"-o <file>\"")
os.Exit(1)
}
output, err := filepath.Abs(output)
if err != nil {
fmt.Printf("Failed to get absolute path of \"%v\": %v", output, err)
os.Exit(1)
}
// Trick: write a dummy bpfObjectsLan{} and bpfObjectsWan{} before call control package.
if err := os.WriteFile(output, []byte(`package control
type bpfObjectsLan struct{}
type bpfObjectsWan struct{}`), 0644); err != nil {
fmt.Printf("Failed to write \"%v\": %v", output, err)
os.Exit(1)
}
fmt.Printf("Generated dummy %v\n", output)
}

View File

@ -1,27 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) 2022-2023, v2rayA Organization <team@v2raya.org>
*/
package main
import (
"flag"
"fmt"
"github.com/v2rayA/dae/control"
"os"
)
func main() {
var output string
flag.StringVar(&output, "o", "", "Place the output into <file>.")
flag.Parse()
if output == "" {
fmt.Println("Please provide flag \"-o <file>\"")
os.Exit(1)
}
fmt.Printf("Generating %v\n", output)
control.GenerateObjects(output)
fmt.Printf("Generated %v\n", output)
}