telstar

package
v0.0.0-...-fd78167 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Split

func Split(s string, l int) []string

Types

type Connection

type Connection struct {
	Address string `json:"address" bson:"address"`
	Mode    string `json:"mode" bson:"mode"`
	Port    int    `json:"port" bson:"port"`
	// contains filtered or unexported fields
}

func (*Connection) GetRemoteConnection

func (c *Connection) GetRemoteConnection() net.Conn

func (*Connection) GetUrl

func (c *Connection) GetUrl() string

func (*Connection) IsValid

func (c *Connection) IsValid() bool

func (*Connection) SetRemoteConnection

func (c *Connection) SetRemoteConnection(value net.Conn)

type Content

type Content struct {
	//Data interface{} `json:"data" bson:"data"`
	Data string `json:"data" bson:"data"`
	Type string `json:"type" bson:"type"`
}

type Frame

type Frame struct {
	//ID interface{} `bson:"_id,omitempty"` // this was used by some on stack overflow
	//ID         primitive.ObjectID `bson:"_id,omitempty"`
	PID          Pid    `json:"pid" bson:"pid"`
	Visible      bool   `json:"visible" bson:"visible"`
	HeaderText   string `json:"header-text" bson:"header-text"`
	Cost         int    `json:"cost" bson:"cost"`
	DisableClear bool   `json:"disable-clear" bson:"disable-clear"`
	//CacheId          string       `json:"cache-id" bson:"cache-id"`
	FrameType    string  `json:"frame-type" bson:"frame-type"`
	Redirect     Pid     `json:"redirect" bson:"redirect"`
	Content      Content `json:"content" bson:"content"`
	Footer       Title   `json:"footer" bson:"footer"`
	Title        Title   `json:"title" bson:"title"`
	RoutingTable []int   `json:"routing-table" bson:"routing-table"`
	// FIXME The Cursor field doesn't seem to be being used at all, either remove it or find a use for it
	//  the cursor in the nav field is added using markup
	Cursor       bool         `json:"cursor" bson:"cursor"`
	Connection   Connection   `json:"connection" bson:"connection"`
	AuthorIdOld  string       `json:"author-id" bson:"author-id"`
	ResponseData ResponseData `json:"response-data" bson:"response-data"`
	// a transient page will not be stored in the database e.g. results of response pages etc.
	//TransientPage bool `json:"transient-page" bson:"transient-page"`
	// these will override the defaults specified in settings at the page level
	NavMessage         string `json:"navmessage-select" bson:"navmessage-select"`
	NavMessageNotFound string `json:"navmessage-notfound" bson:"navmessage-notfound"`
}

Frame from https://bitbucket.org/johnnewcombe/telstar-2/src/master/telstar-library/types/frame.go however cannot import that module so including it here

func (*Frame) CreateDefaultRoutingTable

func (f *Frame) CreateDefaultRoutingTable() []int

func (*Frame) CreateRedirect

func (f *Frame) CreateRedirect(fromPageNumber int, fromFrameId string) Frame

Creates a redirect from the fromPageId to this frame.

func (*Frame) Dump

func (f *Frame) Dump() ([]byte, error)

Dump Returns a Json byte representation of the Frame

func (*Frame) GetPageId

func (f *Frame) GetPageId() string

func (*Frame) GetRedirectPageId

func (f *Frame) GetRedirectPageId() string

func (*Frame) GetZeroPageRoute

func (f *Frame) GetZeroPageRoute() int

GetZeroPageRoute returns the current page appended with 0. For example if the current page is 293, the 'zero' page route would be page 2930.

func (*Frame) IsValid

func (f *Frame) IsValid() bool

func (*Frame) Load

func (f *Frame) Load(jsonBytes []byte) error

Load populates a Frame object from json byte data

type FrameBuilder

type FrameBuilder struct {
	// contains filtered or unexported fields
}

func (*FrameBuilder) Blue

func (b *FrameBuilder) Blue() *FrameBuilder

func (*FrameBuilder) Build

func (b *FrameBuilder) Build() *Response

func (*FrameBuilder) ContentType

func (b *FrameBuilder) ContentType(s string) *FrameBuilder

func (*FrameBuilder) Cyan

func (b *FrameBuilder) Cyan() *FrameBuilder

func (*FrameBuilder) DoubleHeight

func (b *FrameBuilder) DoubleHeight() *FrameBuilder

func (*FrameBuilder) Flash

func (b *FrameBuilder) Flash() *FrameBuilder

func (*FrameBuilder) Green

func (b *FrameBuilder) Green() *FrameBuilder

func (*FrameBuilder) Header

func (b *FrameBuilder) Header(s string, a ...interface{}) *FrameBuilder

func (*FrameBuilder) Magenta

func (b *FrameBuilder) Magenta() *FrameBuilder

func (*FrameBuilder) MosaicBlue

func (b *FrameBuilder) MosaicBlue() *FrameBuilder

func (*FrameBuilder) MosaicCyan

func (b *FrameBuilder) MosaicCyan() *FrameBuilder

func (*FrameBuilder) MosaicGreen

func (b *FrameBuilder) MosaicGreen() *FrameBuilder

func (*FrameBuilder) MosaicMagenta

func (b *FrameBuilder) MosaicMagenta() *FrameBuilder

func (*FrameBuilder) MosaicRed

func (b *FrameBuilder) MosaicRed() *FrameBuilder

func (*FrameBuilder) MosaicWhite

func (b *FrameBuilder) MosaicWhite() *FrameBuilder

func (*FrameBuilder) MosaicYellow

func (b *FrameBuilder) MosaicYellow() *FrameBuilder

func (*FrameBuilder) NavMessage

func (b *FrameBuilder) NavMessage(s string, a ...interface{}) *FrameBuilder

func (*FrameBuilder) NavMessageNotFound

func (b *FrameBuilder) NavMessageNotFound(s string, a ...interface{}) *FrameBuilder

func (*FrameBuilder) NewBackground

func (b *FrameBuilder) NewBackground() *FrameBuilder

func (*FrameBuilder) NewLine

func (b *FrameBuilder) NewLine() *FrameBuilder

func (*FrameBuilder) NormalHeight

func (b *FrameBuilder) NormalHeight() *FrameBuilder

func (*FrameBuilder) Print

func (b *FrameBuilder) Print(s string) *FrameBuilder

func (*FrameBuilder) Printf

func (b *FrameBuilder) Printf(f string, a ...interface{}) *FrameBuilder

func (*FrameBuilder) Println

func (b *FrameBuilder) Println(s string) *FrameBuilder

func (*FrameBuilder) Red

func (b *FrameBuilder) Red() *FrameBuilder

func (*FrameBuilder) Route

func (b *FrameBuilder) Route(i, p int) *FrameBuilder

func (*FrameBuilder) SepGraphDotsHigh

func (b *FrameBuilder) SepGraphDotsHigh() *FrameBuilder

func (*FrameBuilder) SepGraphDotsLow

func (b *FrameBuilder) SepGraphDotsLow() *FrameBuilder

func (*FrameBuilder) SepGraphDotsMid

func (b *FrameBuilder) SepGraphDotsMid() *FrameBuilder

func (*FrameBuilder) SepGraphSolidHigh

func (b *FrameBuilder) SepGraphSolidHigh() *FrameBuilder

func (*FrameBuilder) SepGraphSolidLow

func (b *FrameBuilder) SepGraphSolidLow() *FrameBuilder

func (*FrameBuilder) SepGraphSolidMid

func (b *FrameBuilder) SepGraphSolidMid() *FrameBuilder

func (*FrameBuilder) Steady

func (b *FrameBuilder) Steady() *FrameBuilder

func (*FrameBuilder) White

func (b *FrameBuilder) White() *FrameBuilder

func (*FrameBuilder) Yellow

func (b *FrameBuilder) Yellow() *FrameBuilder

type Pid

type Pid struct {
	PageNumber int    `json:"page-no" bson:"page-no"`
	FrameId    string `json:"frame-id" bson:"frame-id"`
}

func (*Pid) String

func (p *Pid) String() string

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response is returned to Telstar

func NewResponse

func NewResponse() *Response

func (*Response) Build

func (r *Response) Build() (string, error)

func (*Response) Dynamic

func (r *Response) Dynamic() *Response

Dynamic sets the response as dynamic - for use with our fork of Telstar only

func (*Response) FrameId

func (r *Response) FrameId(n byte) *Response

FrameId sets the initial frame id. Default is "a" but can be "b"

func (*Response) NewFrame

func (r *Response) NewFrame() *FrameBuilder

func (*Response) PageNumber

func (r *Response) PageNumber(n int) *Response

PageNumber sets the page number of the response

type ResponseAction

type ResponseAction struct {
	Exec            string   `json:"exec" bson:"exec"`
	Args            []string `json:"args" bson:"args"`
	PostActionFrame Pid      `json:"post-action-frame" bson:"post-action-frame"`
	PostCancelFrame Pid      `json:"post-cancel-frame" bson:"post-cancel-frame"`
}

type ResponseData

type ResponseData struct {
	Fields []ResponseField `json:"response-fields" bson:"responses"`
	Action ResponseAction  `json:"response-action" bson:"response-action"`
}

type ResponseField

type ResponseField struct {
	//	Label    string `json:"label" bson:"label"`
	VPos     int    `json:"vpos" bson:"vpos"`
	HPos     int    `json:"hpos" bson:"hpos"`
	Required bool   `json:"required" bson:"required"`
	Length   int    `json:"length" bson:"length"`
	Type     string `json:"type" bson:"type"`
	// FIXME: this is specified as 'auto_submit' on many response tmp
	// in which case this will always return false, this needs to be fixed
	// in the database for v2
	AutoSubmit bool `json:"auto-submit" bson:"auto-submit"`
	Password   bool `json:"password" bson:"password"`
}

type Title

type Title struct {
	Data      string   `json:"data" bson:"data"`
	Type      string   `json:"type" bson:"type"`
	MergeData []string `json:"merge-data" bson:"merge-data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL