Remove version/build-date info from weaver binary
This commit is contained in:
1 parent
9be3a11e10
commit
39003233ea
3 files changed
+18
-41
No files matched your search
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
all: docker-image
|
all: docker-image
|
||||||
|
|
||||||
weaver: ../*.go main.go
|
weaver: ../*.go main.go
|
||||||
go build -ldflags="-X main.builddate \"`date -u -Iseconds`\" -extldflags '-static'"
|
go build -ldflags '-extldflags "-static"'
|
||||||
|
|
||||||
.PHONY: docker-image
|
.PHONY: docker-image
|
||||||
|
|
||||||
|
|||||||
+1
-15
@@ -18,12 +18,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var builddate string // set by the Makefile
|
|
||||||
|
|
||||||
func versionString() string {
|
|
||||||
return "Weave of " + builddate
|
|
||||||
}
|
|
||||||
|
|
||||||
func ensureInterface(ifaceName string, wait bool) (iface *net.Interface, err error) {
|
func ensureInterface(ifaceName string, wait bool) (iface *net.Interface, err error) {
|
||||||
iface, err = findInterface(ifaceName)
|
iface, err = findInterface(ifaceName)
|
||||||
if err == nil || !wait {
|
if err == nil || !wait {
|
||||||
@@ -68,7 +62,6 @@ func main() {
|
|||||||
password string
|
password string
|
||||||
wait bool
|
wait bool
|
||||||
debug bool
|
debug bool
|
||||||
version bool
|
|
||||||
prof string
|
prof string
|
||||||
peers []string
|
peers []string
|
||||||
connLimit int
|
connLimit int
|
||||||
@@ -80,21 +73,17 @@ func main() {
|
|||||||
flag.StringVar(&password, "password", "", "network password")
|
flag.StringVar(&password, "password", "", "network password")
|
||||||
flag.BoolVar(&wait, "wait", false, "wait for interface to be created and come up")
|
flag.BoolVar(&wait, "wait", false, "wait for interface to be created and come up")
|
||||||
flag.BoolVar(&debug, "debug", false, "enable debug logging")
|
flag.BoolVar(&debug, "debug", false, "enable debug logging")
|
||||||
flag.BoolVar(&version, "version", false, "display version information")
|
|
||||||
flag.StringVar(&prof, "profile", "", "enable profiling and write profiles to given path")
|
flag.StringVar(&prof, "profile", "", "enable profiling and write profiles to given path")
|
||||||
flag.IntVar(&connLimit, "connlimit", 10, "connection limit (defaults to 10, set to 0 for unlimited)")
|
flag.IntVar(&connLimit, "connlimit", 10, "connection limit (defaults to 10, set to 0 for unlimited)")
|
||||||
flag.IntVar(&bufSz, "bufsz", 8, "capture buffer size in MB (defaults to 8MB)")
|
flag.IntVar(&bufSz, "bufsz", 8, "capture buffer size in MB (defaults to 8MB)")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
peers = flag.Args()
|
peers = flag.Args()
|
||||||
|
|
||||||
if version {
|
|
||||||
fmt.Println(versionString())
|
|
||||||
}
|
|
||||||
if ifaceName == "" {
|
if ifaceName == "" {
|
||||||
fmt.Println("Missing required parameter 'iface'")
|
fmt.Println("Missing required parameter 'iface'")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log.Println(versionString(), os.Args)
|
log.Println("Weave: ", os.Args)
|
||||||
iface, err := ensureInterface(ifaceName, wait)
|
iface, err := ensureInterface(ifaceName, wait)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@@ -151,9 +140,6 @@ func handleHttp(router *weave.Router) {
|
|||||||
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
|
||||||
io.WriteString(w, router.Status())
|
io.WriteString(w, router.Status())
|
||||||
})
|
})
|
||||||
http.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
io.WriteString(w, versionString()+"\n")
|
|
||||||
})
|
|
||||||
address := fmt.Sprintf(":%d", weave.StatusPort)
|
address := fmt.Sprintf(":%d", weave.StatusPort)
|
||||||
err := http.ListenAndServe(address, nil)
|
err := http.ListenAndServe(address, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+16
-25
@@ -68,26 +68,6 @@ setup_masquerading() {
|
|||||||
add_nat_rule "POSTROUTING -s $IPADDR ! -o $BRIDGE -j MASQUERADE"
|
add_nat_rule "POSTROUTING -s $IPADDR ! -o $BRIDGE -j MASQUERADE"
|
||||||
}
|
}
|
||||||
|
|
||||||
rest_command() {
|
|
||||||
RESTCOMMAND=$1
|
|
||||||
if ! DOCKERIP=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' weave 2>/dev/null) ; then
|
|
||||||
echo "Weave is not running." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ -z "$DOCKERIP" ] ; then
|
|
||||||
echo "Weave is not running." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if command_exists wget ; then
|
|
||||||
wget -O - -q $DOCKERIP:6784/$RESTCOMMAND
|
|
||||||
elif command_exists curl ; then
|
|
||||||
curl $DOCKERIP:6784/$RESTCOMMAND
|
|
||||||
else
|
|
||||||
echo "Cannot find wget or curl. Install one of them for 'weave $RESTCOMMAND' to function." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$COMMAND" in
|
case "$COMMAND" in
|
||||||
launch)
|
launch)
|
||||||
[ $# -gt 0 ] || usage
|
[ $# -gt 0 ] || usage
|
||||||
@@ -124,11 +104,22 @@ case "$COMMAND" in
|
|||||||
IFACE=eth0
|
IFACE=eth0
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
rest_command status
|
if ! DOCKERIP=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' weave 2>/dev/null) ; then
|
||||||
exit 0
|
echo "Weave is not running." >&2
|
||||||
;;
|
exit 1
|
||||||
version)
|
fi
|
||||||
rest_command version
|
if [ -z "$DOCKERIP" ] ; then
|
||||||
|
echo "Weave is not running." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if command_exists wget ; then
|
||||||
|
wget -O - -q $DOCKERIP:6784/status
|
||||||
|
elif command_exists curl ; then
|
||||||
|
curl $DOCKERIP:6784/status
|
||||||
|
else
|
||||||
|
echo "Cannot find wget or curl. Install one of them for 'weave status' to function." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
run)
|
run)
|
||||||
|
|||||||
Reference in new issue
Block a user