Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GopherItem

Gopher helper class for use with gopher plugins.

This class represents a single line of unserialized Gopher text. Right before any text gets sent back to the client, the GopherServer will call the serialize method on each item.

This class also contains static utility methods for generating an empty line in Gopher (helpful if you want to space out your GopherHole!) and also to generate a Gopher info line with you text of choice (Useful for things like a banner).

Hierarchy

  • GopherItem

Index

Constructors

constructor

  • new GopherItem(type: GopherItemTypes, description: string, selector?: undefined | string, host?: undefined | string, port?: undefined | number): GopherItem
  • Parameters

    • type: GopherItemTypes
    • description: string
    • Optional selector: undefined | string
    • Optional host: undefined | string
    • Optional port: undefined | number

    Returns GopherItem

Properties

Optional host

host: undefined | string

The hostname to use so that gopher clients know where to contact when they want a resource.

note

this is optional as in most cases you will not need to modify the hostname of a GopherItem unless you were planning on sending the client to a different GopherHole. By default, the GopherServer will set the hostname to be what was set when the server started.

Optional port

port: undefined | number

The port to use so that gopher clients know where to contact when they want a resource.

note

this is optional as in most cases you will not need to modify the port of a GopherItem unless you were planning on sending the client to a different port. By default, the GopherServer will set the port to be what was set when the server started.

Optional selector

selector: undefined | string

The selector is what makes this GopherItem unique to a client.

E.g. Lets say the selector is /cats/shorthair and is a directory entity type and the user selects this item in a gopher client, the gopher server will receive "/cats/shorthair" and will have to make a decision on how to handle that.

Methods

serialize

  • serialize(): string
  • Returns string

Static generateEmptyItem

Static generateInfoItem

  • generateInfoItem(description: string): GopherItem
  • Parameters

    • description: string

    Returns GopherItem

Generated using TypeDoc