2022-01-17 22:38:56 +00:00
|
|
|
package protocol
|
|
|
|
|
2022-02-03 16:44:08 +00:00
|
|
|
var (
|
|
|
|
ErrSyntaxError = NNTPResponse{Code: 501, Message: "Syntax Error"}
|
|
|
|
)
|
|
|
|
|
|
|
|
func IsMessageHeaderAllowed(headerName string) bool {
|
|
|
|
switch headerName {
|
|
|
|
case
|
|
|
|
"Date",
|
|
|
|
"From",
|
|
|
|
"Message-ID",
|
|
|
|
"Newsgroups",
|
|
|
|
"Path",
|
|
|
|
"Subject",
|
|
|
|
"Comments",
|
|
|
|
"Keywords",
|
|
|
|
"In-Reply-To",
|
|
|
|
"Sender",
|
|
|
|
"MIME-Version",
|
|
|
|
"Content-Type",
|
|
|
|
"Content-Transfer-Encoding",
|
|
|
|
"Content-Disposition",
|
|
|
|
"Content-Language",
|
|
|
|
"Approved",
|
|
|
|
"Archive",
|
|
|
|
"Control",
|
|
|
|
"Distribution",
|
|
|
|
"Expires",
|
|
|
|
"Followup-To",
|
|
|
|
"Injection-Date",
|
|
|
|
"Injection-Info",
|
|
|
|
"Organization",
|
|
|
|
"References",
|
|
|
|
"Summary",
|
|
|
|
"Supersedes",
|
|
|
|
"User-Agent",
|
|
|
|
"Xref":
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-01-18 15:04:20 +00:00
|
|
|
const (
|
|
|
|
CRLF = "\r\n"
|
|
|
|
MultilineEnding = "."
|
|
|
|
)
|
|
|
|
|
2022-01-17 22:38:56 +00:00
|
|
|
const (
|
|
|
|
CommandCapabilities = "CAPABILITIES"
|
|
|
|
CommandQuit = "QUIT"
|
|
|
|
CommandDate = "DATE"
|
|
|
|
CommandMode = "MODE"
|
|
|
|
CommandList = "LIST"
|
2022-01-25 16:27:58 +00:00
|
|
|
CommandGroup = "GROUP"
|
2022-01-25 21:29:30 +00:00
|
|
|
CommandNewGroups = "NEWGROUPS"
|
2022-02-03 16:44:08 +00:00
|
|
|
CommandPost = "POST"
|
2022-02-03 17:39:08 +00:00
|
|
|
CommandListGroup = "LISTGROUP"
|
2022-02-05 10:51:50 +00:00
|
|
|
CommandArticle = "ARTICLE"
|
2022-02-05 14:40:38 +00:00
|
|
|
CommandHead = "HEAD"
|
2022-02-05 14:46:25 +00:00
|
|
|
CommandBody = "BODY"
|
2022-02-05 15:20:22 +00:00
|
|
|
CommandStat = "STAT"
|
2022-02-05 15:32:38 +00:00
|
|
|
CommandHelp = "HELP"
|
2022-02-05 15:42:23 +00:00
|
|
|
CommandNewNews = "NEWNEWS"
|
2022-02-05 16:19:43 +00:00
|
|
|
CommandLast = "LAST"
|
2022-02-05 16:23:20 +00:00
|
|
|
CommandNext = "NEXT"
|
2022-01-17 22:38:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2022-01-18 15:04:20 +00:00
|
|
|
CapabilityNameVersion = "VERSION"
|
|
|
|
CapabilityNameReader = "READER"
|
|
|
|
CapabilityNameIHave = "IHAVE"
|
|
|
|
CapabilityNamePost = "POST"
|
|
|
|
CapabilityNameNewNews = "NEWNEWS"
|
|
|
|
CapabilityNameHdr = "HDR"
|
|
|
|
CapabilityNameOver = "OVER"
|
|
|
|
CapabilityNameList = "LIST"
|
|
|
|
CapabilityNameImplementation = "IMPLEMENTATION"
|
|
|
|
CapabilityNameModeReader = "MODE-READER"
|
|
|
|
)
|