限制TCP和UDP网站操作HTTP网站的功能

This commit is contained in:
GoEdgeLab
2024-04-14 16:45:17 +08:00
parent b4625f6abf
commit 662e621a9e
24 changed files with 125 additions and 3 deletions

View File

@@ -169,3 +169,14 @@ func (this *ParentAction) FailLang(messageCode langs.MessageCode, args ...any) {
func (this *ParentAction) FailFieldLang(field string, messageCode langs.MessageCode, args ...any) {
this.FailField(field, langs.Message(this.LangCode(), messageCode, args...))
}
func (this *ParentAction) FilterHTTPFamily() bool {
if this.Data.GetString("serverFamily") == "http" {
return false
}
this.ResponseWriter.WriteHeader(http.StatusNotFound)
_, _ = this.ResponseWriter.Write([]byte("page not found"))
return true
}