Add build for multiple architectures, streamline process
This commit is contained in:
parent
1ec9477d69
commit
b7c5e6afba
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.idea
|
.idea
|
||||||
|
bin/
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Makefile for PNDPD
|
||||||
|
|
||||||
|
BINARY=pndpd
|
||||||
|
MODULES=
|
||||||
|
VERSION=`git describe --tags`
|
||||||
|
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -tags=${MODULES} -o bin/${BINARY} .
|
||||||
|
|
||||||
|
release:
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags=${MODULES} ${LDFLAGS} -o bin/${BINARY}_linux_amd64.bin .
|
||||||
|
|
||||||
|
release-all:
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags=${MODULES} ${LDFLAGS} -o bin/${BINARY}_linux_amd64.bin
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags=${MODULES} ${LDFLAGS} -o bin/${BINARY}_linux_arm64.bin
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -tags=${MODULES} ${LDFLAGS} -o bin/${BINARY}_linux_arm.bin
|
||||||
|
|
||||||
|
clean:
|
||||||
|
find bin/ -type f -delete
|
||||||
|
if [ -d "bin/" ]; then rm -d bin/ ;fi
|
@ -33,6 +33,13 @@ pndpd proxy <interface1> <interface2> <optional whitelist of CIDRs separated by
|
|||||||
More options and additional documentation in the example config file (``pndpd.conf ``).
|
More options and additional documentation in the example config file (``pndpd.conf ``).
|
||||||
|
|
||||||
## Developing
|
## Developing
|
||||||
|
|
||||||
|
### Building
|
||||||
|
For building, the version of go needs to be installed that is specified in the go.mod file. A makefile is available. Optionally adjust the modules variable to include/exclude modules from the modules directory.
|
||||||
|
````
|
||||||
|
make build
|
||||||
|
make release
|
||||||
|
````
|
||||||
### Adding Modules
|
### Adding Modules
|
||||||
It is easy to add functionality to PNDPD. For additions outside the core functionality you only need to keep the following methods in mind:
|
It is easy to add functionality to PNDPD. For additions outside the core functionality you only need to keep the following methods in mind:
|
||||||
````
|
````
|
||||||
|
18
main.go
18
main.go
@ -13,16 +13,10 @@ import (
|
|||||||
_ "pndpd/modules/userInterface"
|
_ "pndpd/modules/userInterface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// waitForSignal Waits (blocking) for the program to be interrupted by the OS
|
var Version = "Development"
|
||||||
func waitForSignal() {
|
|
||||||
var sigCh = make(chan os.Signal, 1)
|
|
||||||
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
|
|
||||||
<-sigCh
|
|
||||||
close(sigCh)
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("PNDPD Version 1.2.1 - Kioubit 2021")
|
fmt.Println("PNDPD Version", Version, "- Kioubit 2021")
|
||||||
|
|
||||||
if len(os.Args) <= 2 {
|
if len(os.Args) <= 2 {
|
||||||
printUsage()
|
printUsage()
|
||||||
@ -64,3 +58,11 @@ func printUsage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// waitForSignal Waits (blocking) for the program to be interrupted by the OS
|
||||||
|
func waitForSignal() {
|
||||||
|
var sigCh = make(chan os.Signal, 1)
|
||||||
|
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
|
||||||
|
<-sigCh
|
||||||
|
close(sigCh)
|
||||||
|
}
|
||||||
|
@ -13,7 +13,7 @@ responder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Proxy example
|
// Proxy example
|
||||||
// Create an NDP proxy that for proxying NDP between iface1 ("eth0") and iface2 ("eth1")
|
// Create an NDP proxy for proxying NDP between iface1 ("eth0") and iface2 ("eth1")
|
||||||
// The whitelist is applied on iface2
|
// The whitelist is applied on iface2
|
||||||
proxy {
|
proxy {
|
||||||
iface1 eth0
|
iface1 eth0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user