mirror of
https://github.com/mpolden/echoip.git
synced 2025-01-27 02:15:01 +01:00
Add Mikrotik as CLI client (#69)
This commit is contained in:
parent
4ce6452332
commit
fb5fac92d2
@ -274,7 +274,7 @@ func NotFoundHandler(w http.ResponseWriter, r *http.Request) *appError {
|
|||||||
func cliMatcher(r *http.Request) bool {
|
func cliMatcher(r *http.Request) bool {
|
||||||
ua := useragent.Parse(r.UserAgent())
|
ua := useragent.Parse(r.UserAgent())
|
||||||
switch ua.Product {
|
switch ua.Product {
|
||||||
case "curl", "HTTPie", "Wget", "fetch libfetch", "Go", "Go-http-client", "ddclient":
|
case "curl", "HTTPie", "Wget", "fetch libfetch", "Go", "Go-http-client", "ddclient", "Mikrotik":
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -208,6 +208,7 @@ func TestCLIMatcher(t *testing.T) {
|
|||||||
{"Go-http-client/1.1", true},
|
{"Go-http-client/1.1", true},
|
||||||
{"Go-http-client/2.0", true},
|
{"Go-http-client/2.0", true},
|
||||||
{"ddclient/3.8.3", true},
|
{"ddclient/3.8.3", true},
|
||||||
|
{"Mikrotik/6.x Fetch", true},
|
||||||
{browserUserAgent, false},
|
{browserUserAgent, false},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -17,6 +17,7 @@ func TestParse(t *testing.T) {
|
|||||||
{"Wget", UserAgent{Product: "Wget"}},
|
{"Wget", UserAgent{Product: "Wget"}},
|
||||||
{"fetch libfetch/2.0", UserAgent{Product: "fetch libfetch", Version: "2.0"}},
|
{"fetch libfetch/2.0", UserAgent{Product: "fetch libfetch", Version: "2.0"}},
|
||||||
{"Go 1.1 package http", UserAgent{Product: "Go", Comment: "1.1 package http"}},
|
{"Go 1.1 package http", UserAgent{Product: "Go", Comment: "1.1 package http"}},
|
||||||
|
{"Mikrotik/6.x Fetch", UserAgent{Product: "Mikrotik", Version: "6.x", Comment: "Fetch"}},
|
||||||
{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) " +
|
{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) " +
|
||||||
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.28 " +
|
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.28 " +
|
||||||
"Safari/537.36", UserAgent{Product: "Mozilla", Version: "5.0", Comment: "(Macintosh; Intel Mac OS X 10_8_4) " +
|
"Safari/537.36", UserAgent{Product: "Mozilla", Version: "5.0", Comment: "(Macintosh; Intel Mac OS X 10_8_4) " +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user