|
|
|
@ -2,6 +2,11 @@ package gopher
|
|
|
|
|
|
|
|
|
|
import "gophor/core"
|
|
|
|
|
|
|
|
|
|
// We make heavy-use of string concat here instead of StringBuilder
|
|
|
|
|
// as this is performed during the setup phase of the server and therefore
|
|
|
|
|
// doesn't impact run-time performance.
|
|
|
|
|
|
|
|
|
|
// generatePolicyHeader generates a commented-out header for a policy file of supplied name
|
|
|
|
|
func generatePolicyHeader(name string) string {
|
|
|
|
|
text := "# This is an automatically generated" + "\r\n"
|
|
|
|
|
text += "# server policy file: " + name + "\r\n"
|
|
|
|
@ -10,6 +15,7 @@ func generatePolicyHeader(name string) string {
|
|
|
|
|
return text
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// generateCapsTxt generates a byte slice of what would be a 'caps.txt' policy file
|
|
|
|
|
func generateCapsTxt(desc, admin, geo string) []byte {
|
|
|
|
|
text := "CAPS" + "\r\n"
|
|
|
|
|
text += "\r\n"
|
|
|
|
@ -35,6 +41,7 @@ func generateCapsTxt(desc, admin, geo string) []byte {
|
|
|
|
|
return []byte(text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// generateRobotsTxt generates a byte slice of what would be a 'robots.txt' policy file
|
|
|
|
|
func generateRobotsTxt() []byte {
|
|
|
|
|
text := generatePolicyHeader("robots.txt")
|
|
|
|
|
text += "\r\n"
|
|
|
|
|