summaryrefslogtreecommitdiff
path: root/gopher/response.go
diff options
context:
space:
mode:
Diffstat (limited to 'gopher/response.go')
-rw-r--r--gopher/response.go70
1 files changed, 35 insertions, 35 deletions
diff --git a/gopher/response.go b/gopher/response.go
index c600b10..566623f 100644
--- a/gopher/response.go
+++ b/gopher/response.go
@@ -6,49 +6,49 @@ import (
"io"
"sync"
- "tildegit.org/tjp/gus"
+ sr "tildegit.org/tjp/sliderule"
)
// The Canonical gopher item types.
const (
- TextFileType gus.Status = '0'
- MenuType gus.Status = '1'
- CSOPhoneBookType gus.Status = '2'
- ErrorType gus.Status = '3'
- MacBinHexType gus.Status = '4'
- DosBinType gus.Status = '5'
- UuencodedType gus.Status = '6'
- SearchType gus.Status = '7'
- TelnetSessionType gus.Status = '8'
- BinaryFileType gus.Status = '9'
- MirrorServerType gus.Status = '+'
- GifFileType gus.Status = 'g'
- ImageFileType gus.Status = 'I'
- Telnet3270Type gus.Status = 'T'
+ TextFileType sr.Status = '0'
+ MenuType sr.Status = '1'
+ CSOPhoneBookType sr.Status = '2'
+ ErrorType sr.Status = '3'
+ MacBinHexType sr.Status = '4'
+ DosBinType sr.Status = '5'
+ UuencodedType sr.Status = '6'
+ SearchType sr.Status = '7'
+ TelnetSessionType sr.Status = '8'
+ BinaryFileType sr.Status = '9'
+ MirrorServerType sr.Status = '+'
+ GifFileType sr.Status = 'g'
+ ImageFileType sr.Status = 'I'
+ Telnet3270Type sr.Status = 'T'
)
// The gopher+ types.
const (
- BitmapType gus.Status = ':'
- MovieFileType gus.Status = ';'
- SoundFileType gus.Status = '<'
+ BitmapType sr.Status = ':'
+ MovieFileType sr.Status = ';'
+ SoundFileType sr.Status = '<'
)
// The various non-canonical gopher types.
const (
- DocumentType gus.Status = 'd'
- HTMLType gus.Status = 'h'
- InfoMessageType gus.Status = 'i'
- PngImageFileType gus.Status = 'p'
- RtfDocumentType gus.Status = 'r'
- WavSoundFileType gus.Status = 's'
- PdfDocumentType gus.Status = 'P'
- XmlDocumentType gus.Status = 'X'
+ DocumentType sr.Status = 'd'
+ HTMLType sr.Status = 'h'
+ InfoMessageType sr.Status = 'i'
+ PngImageFileType sr.Status = 'p'
+ RtfDocumentType sr.Status = 'r'
+ WavSoundFileType sr.Status = 's'
+ PdfDocumentType sr.Status = 'P'
+ XmlDocumentType sr.Status = 'X'
)
// MapItem is a single item in a gophermap.
type MapItem struct {
- Type gus.Status
+ Type sr.Status
Display string
Selector string
Hostname string
@@ -70,8 +70,8 @@ func (mi MapItem) String() string {
// Response builds a response which contains just this single MapItem.
//
// Meta in the response will be a pointer to the MapItem.
-func (mi *MapItem) Response() *gus.Response {
- return &gus.Response{
+func (mi *MapItem) Response() *sr.Response {
+ return &sr.Response{
Status: mi.Type,
Meta: &mi,
Body: bytes.NewBufferString(mi.String() + ".\r\n"),
@@ -89,8 +89,8 @@ func (md MapDocument) String() string {
// Response builds a gopher response containing the gophermap.
//
// Meta will be the MapDocument itself.
-func (md MapDocument) Response() *gus.Response {
- return &gus.Response{
+func (md MapDocument) Response() *sr.Response {
+ return &sr.Response{
Status: DocumentType,
Meta: md,
Body: md.serialize(),
@@ -119,12 +119,12 @@ func Error(err error) *MapItem {
// File builds a minimal response delivering a file's contents.
//
// Meta is nil and Status is 0 in this response.
-func File(status gus.Status, contents io.Reader) *gus.Response {
- return &gus.Response{Status: status, Body: contents}
+func File(status sr.Status, contents io.Reader) *sr.Response {
+ return &sr.Response{Status: status, Body: contents}
}
// NewResponseReader produces a reader which supports reading gopher protocol responses.
-func NewResponseReader(response *gus.Response) gus.ResponseReader {
+func NewResponseReader(response *sr.Response) sr.ResponseReader {
return &responseReader{
Response: response,
once: &sync.Once{},
@@ -132,7 +132,7 @@ func NewResponseReader(response *gus.Response) gus.ResponseReader {
}
type responseReader struct {
- *gus.Response
+ *sr.Response
reader io.Reader
once *sync.Once
}