Add UDP proxy support
This commit is contained in:
@ -86,6 +86,12 @@ func HandleAdd(db *noodle.Database, pc *chan noodle.Noodle) func(w http.Response
|
||||
return
|
||||
}
|
||||
|
||||
proto := strings.ToUpper(strings.TrimSpace(req.FormValue("proto")))
|
||||
if proto != "TCP" && proto != "UDP" {
|
||||
http.Error(w, "invalid protocol", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
clientIP := clientIPFromRequest(req)
|
||||
src := strings.TrimSpace(req.FormValue("src"))
|
||||
if src == clientIP {
|
||||
@ -99,7 +105,7 @@ func HandleAdd(db *noodle.Database, pc *chan noodle.Noodle) func(w http.Response
|
||||
item := noodle.Noodle{
|
||||
Id: db.MakeID(),
|
||||
Name: strings.TrimSpace(req.FormValue("name")),
|
||||
Proto: "TCP",
|
||||
Proto: proto,
|
||||
Src: src,
|
||||
ListenPort: listenPort,
|
||||
DestPort: destPort,
|
||||
|
||||
Reference in New Issue
Block a user