updates to address comments by @bboreham
This commit is contained in:
1 parent
4b9c533b94
commit
c9f1d30f49
3 files changed
+5
-9
No files matched your search
@@ -36,9 +36,6 @@ coverage.html
|
|||||||
# Sed backup files
|
# Sed backup files
|
||||||
*.bak
|
*.bak
|
||||||
|
|
||||||
# JetBrains/GoLand/IntelliJ project file
|
|
||||||
.idea
|
|
||||||
|
|
||||||
# Project specific
|
# Project specific
|
||||||
prog/weaver/weaver
|
prog/weaver/weaver
|
||||||
prog/weavedns/weavedns
|
prog/weavedns/weavedns
|
||||||
|
|||||||
+4
-5
@@ -30,18 +30,17 @@ func (router *NetworkRouter) HandleHTTP(muxRouter *mux.Router) {
|
|||||||
router.ForgetConnections(r.Form["peer"])
|
router.ForgetConnections(r.Form["peer"])
|
||||||
})
|
})
|
||||||
|
|
||||||
muxRouter.Methods("POST").Path("/expose/{ip}/{prefixlen}/{skipNAT}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
muxRouter.Methods("POST").Path("/expose/{ip}/{prefixlen}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
var skipNAT bool
|
|
||||||
cidr, err := address.ParseCIDR(vars["ip"] + "/" + vars["prefixlen"])
|
cidr, err := address.ParseCIDR(vars["ip"] + "/" + vars["prefixlen"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, fmt.Sprint("unable to parse ip addr: ", err.Error()), http.StatusBadRequest)
|
http.Error(w, fmt.Sprint("unable to parse ip addr: ", err.Error()), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if vars["skipNAT"] != "" {
|
var skipNAT bool
|
||||||
skipNAT, err = strconv.ParseBool(vars["skipNAT"])
|
if r.FormValue("skipNAT") != "" {
|
||||||
if err != nil {
|
if skipNAT, err = strconv.ParseBool(r.FormValue("skipNAT")); err != nil {
|
||||||
http.Error(w, fmt.Sprint("unable to parse skipNAT option: ", err.Error()), http.StatusBadRequest)
|
http.Error(w, fmt.Sprint("unable to parse skipNAT option: ", err.Error()), http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
expose_ip() {
|
expose_ip() {
|
||||||
[ -z $WITHOUT_MASQUERADE ] || skipNAT="/true"
|
[ -z $WITHOUT_MASQUERADE ] || skipNAT="?skipNAT=true"
|
||||||
ipam_cidrs allocate_no_check_alive weave:expose $CIDR_ARGS
|
ipam_cidrs allocate_no_check_alive weave:expose $CIDR_ARGS
|
||||||
for CIDR in $ALL_CIDRS ; do
|
for CIDR in $ALL_CIDRS ; do
|
||||||
call_weave "POST" "/expose/$CIDR$skipNAT"
|
call_weave "POST" "/expose/$CIDR$skipNAT"
|
||||||
|
|||||||
Reference in new issue
Block a user