Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
./build.sh linux amd64
./build.sh linux 386
#./build.sh linux arm64
./build.sh linux mips64
./build.sh linux mips64le
./build.sh darwin amd64
#./build.sh darwin arm64
./build.sh windows amd64
./build.sh windows 386

View File

@@ -0,0 +1,71 @@
#!/usr/bin/env bash
function build() {
ROOT=$(dirname $0)
NAME="edge-reporter"
VERSION=$(lookup-version $ROOT/../internal/const/const.go)
DIST=$ROOT/"../dist/${NAME}"
OS=${1}
ARCH=${2}
EXE=""
if [ -z $OS ]; then
echo "usage: build.sh OS ARCH"
exit
fi
if [ -z $ARCH ]; then
echo "usage: build.sh OS ARCH"
exit
fi
if [ "$OS" == "windows" ]; then
EXE=".exe"
fi
echo "checking ..."
ZIP_PATH=$(which zip)
if [ -z $ZIP_PATH ]; then
echo "we need 'zip' command to compress files"
exit
fi
echo "copying ..."
if [ ! -d $DIST ]; then
mkdir $DIST
mkdir $DIST/bin
mkdir $DIST/configs
mkdir $DIST/logs
fi
cp $ROOT/configs/api_reporter.template.yaml $DIST/configs
echo "building v${VERSION}/${OS}/${ARCH} ..."
ZIP="${NAME}-${OS}-${ARCH}-v${VERSION}.zip"
env GOOS=${OS} GOARCH=${ARCH} go build -trimpath -o $DIST/bin/${NAME}${EXE} -ldflags="-s -w" $ROOT/../cmd/edge-reporter/main.go
echo "zip files"
cd "${DIST}/../" || exit
if [ -f "${ZIP}" ]; then
rm -f "${ZIP}"
fi
zip -r -X -q "${ZIP}" ${NAME}/
rm -rf ${NAME}
cd - || exit
echo "OK"
}
function lookup-version() {
FILE=$1
VERSION_DATA=$(cat $FILE)
re="Version[ ]+=[ ]+\"([0-9.]+)\""
if [[ $VERSION_DATA =~ $re ]]; then
VERSION=${BASH_REMATCH[1]}
echo $VERSION
else
echo "could not match version"
exit
fi
}
build $1 $2

2
EdgeReporter/build/configs/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
api.yaml
api_reporter.yaml

View File

@@ -0,0 +1,3 @@
rpc.endpoints: [ "http://127.0.0.1:8003" ]
nodeId: ""
secret: ""

1
EdgeReporter/build/logs/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.log