ran 'go fmt'; cosmetic changes

This commit is contained in:
Bryan Boreham committed 2014-08-29 14:51:31 +01:00
1 parent a113da0e34
commit 94e00e2c8e
4 files changed
+21 -20

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ const (
EthernetOverhead = 14 EthernetOverhead = 14
UDPOverhead = 28 // 20 bytes for IPv4, 8 bytes for UDP UDPOverhead = 28 // 20 bytes for IPv4, 8 bytes for UDP
Port = 6783 Port = 6783
StatusPort = Port+1 StatusPort = Port + 1
DefaultPMTU = 65535 DefaultPMTU = 65535
MaxUDPPacketSize = 65536 MaxUDPPacketSize = 65536
ChannelSize = 16 ChannelSize = 16
+15 -15
View File
@@ -2,33 +2,33 @@ package weave
import ( import (
"fmt" "fmt"
"net/http" "net/http"
) )
/* A simple http responder that will show the status of the router when asked, /* A simple http responder that will show the status of the router when asked,
e.g. via http://172.17.0.2/status e.g. via http://172.17.0.2/status
*/ */
type HttpStatusResponder struct { type HttpStatusResponder struct {
router *Router router *Router
} }
func NewHttpStatusResponder(router *Router) *HttpStatusResponder { func NewHttpStatusResponder(router *Router) *HttpStatusResponder {
resp := &HttpStatusResponder{router} resp := &HttpStatusResponder{router}
return resp return resp
} }
func (resp *HttpStatusResponder) SetRouter(newRouter *Router) { func (resp *HttpStatusResponder) SetRouter(newRouter *Router) {
resp.router = newRouter resp.router = newRouter
} }
func (resp *HttpStatusResponder) ListenAndServe() { func (resp *HttpStatusResponder) ListenAndServe() {
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
if resp.router != nil { if resp.router != nil {
fmt.Fprint(w, resp.router.Status()) fmt.Fprint(w, resp.router.Status())
} else { } else {
fmt.Fprintf(w, "Not initialized") fmt.Fprintf(w, "Not initialized")
} }
}) })
address := fmt.Sprintf(":%d", StatusPort) address := fmt.Sprintf(":%d", StatusPort)
http.ListenAndServe(address, nil) http.ListenAndServe(address, nil)
} }
+3 -3
View File
@@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/bboreham/weave" "github.com/zettio/weave"
"code.google.com/p/gopacket/layers" "code.google.com/p/gopacket/layers"
"crypto/sha256" "crypto/sha256"
"flag" "flag"
@@ -123,8 +123,8 @@ func main() {
} }
}() }()
} }
httpResponder := weave.NewHttpStatusResponder(router) httpResponder := weave.NewHttpStatusResponder(router)
go httpResponder.ListenAndServe() go httpResponder.ListenAndServe()
handleSignals(router) handleSignals(router)
} }
+2 -1
View File
@@ -106,7 +106,8 @@ ip netns exec $NSPID ip link set $GUEST_IFNAME name $CONTAINER_IFNAME
ip netns exec $NSPID ip addr add $IPADDR dev $CONTAINER_IFNAME ip netns exec $NSPID ip addr add $IPADDR dev $CONTAINER_IFNAME
ip netns exec $NSPID ip link set $CONTAINER_IFNAME up ip netns exec $NSPID ip link set $CONTAINER_IFNAME up
if command -v ethtool >/dev/null 2>&1 ; then if [ command -v ethtool >/dev/null 2>&1 ]
then
ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null
else else
echo "Cannot find ethtool; continuing without it" >&2 echo "Cannot find ethtool; continuing without it" >&2