From 51560e4b18d4514e512a539db79938a92f567b79 Mon Sep 17 00:00:00 2001 From: "kim (grufwub)" Date: Mon, 13 Jul 2020 10:30:26 +0100 Subject: [PATCH] add code comments Signed-off-by: kim (grufwub) --- gopher/policy.go | 7 +++++++ 1 file changed, 7 insertions(+) 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"