diff --git a/gopher/policy.go b/gopher/policy.go index 6fde523..6bac041 100644 --- a/gopher/policy.go +++ b/gopher/policy.go @@ -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"