reorganize
This commit is contained in:
parent
e77a56e4bc
commit
f5d0608e03
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
if [ -z ${1+x} ]; then
|
||||
VERSION="0.0.0"
|
||||
else
|
||||
VERSION="$1"
|
||||
fi
|
||||
|
||||
mkdir -p "$SCRIPT_DIR/dist"
|
||||
rm "$SCRIPT_DIR"/dist/* &> /dev/null
|
||||
|
||||
BUILDARGS="$(uname)-$(uname -p)"
|
||||
OUTPUTFILE="$SCRIPT_DIR/dist/freematics-encrypt-$VERSION-$BUILDARGS"
|
||||
|
||||
cd "$SCRIPT_DIR/src" || exit 1
|
||||
go mod tidy
|
||||
go build -v -trimpath -ldflags "-s -w -X main.VersionDate=$(date -u --iso-8601=minutes) -X main.Version=v$VERSION" -o "$OUTPUTFILE"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
chmod +x "$OUTPUTFILE"
|
||||
echo "Build Succeeded -> $OUTPUTFILE"
|
||||
fi
|
|
@ -30,7 +30,7 @@ func main() {
|
|||
logger := logging.GetLogger()
|
||||
|
||||
if *configFile == "" {
|
||||
logger.Fatalln("Please provide a configuration file")
|
||||
logger.Fatalln("Provide a configuration file via --config")
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(*configFile)
|
||||
|
@ -96,6 +96,7 @@ func main() {
|
|||
}
|
||||
} else {
|
||||
plaintext = buf[:n]
|
||||
logger.Warningln("Got unencrypted message!")
|
||||
}
|
||||
|
||||
forwardAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", dest.Address, dest.Port))
|
||||
|
@ -142,8 +143,6 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
//fmt.Println(string(backendResponse[:]))
|
||||
|
||||
// Encrypt the backend's response.
|
||||
encryptedBackendResponse, err := encryption.Encrypt(key, backendResponse[:n])
|
||||
if err != nil {
|
Loading…
Reference in New Issue