Documentation ¶
Index ¶
- Constants
- Variables
- func PrintUsage(hint string, usage ...string)
- func PrintVersion()
- func ReadFromFile(timeout int, msgChan chan Message, doneChan chan any, fReader io.Reader)
- func ReadFromNetwork(timeout int, msgChan chan Message, doneChan chan any, connection Connection)
- type Connection
- type DisplayPreference
- type Message
- type NotificationEngine
- func (ne *NotificationEngine) ClearNetworkError()
- func (ne *NotificationEngine) GetNotificationString() string
- func (ne *NotificationEngine) ServerAcked(ts int64)
- func (ne *NotificationEngine) ServerHeard(ts int64)
- func (ne *NotificationEngine) SetEscapeKeyString(str string)
- func (ne *NotificationEngine) SetNetworkError(str string)
- func (ne *NotificationEngine) SetNotificationString(message string, permanent bool, showQuitKeystroke bool)
- type OverlayManager
- type PredictionEngine
- func (pe *PredictionEngine) NewUserInput(emu *terminal.Emulator, input []rune)
- func (pe *PredictionEngine) Reset()
- func (pe *PredictionEngine) SetDisplayPreference(v DisplayPreference)
- func (pe *PredictionEngine) SetLocalFrameAcked(v uint64)
- func (pe *PredictionEngine) SetLocalFrameLateAcked(v uint64)
- func (pe *PredictionEngine) SetLocalFrameSent(v uint64)
- func (pe *PredictionEngine) SetPredictOverwrite(overwrite bool)
- func (pe *PredictionEngine) SetSendInterval(value uint)
- type Signals
- type TitleEngine
- type Validity
Constants ¶
const ( AprilshMsgOpen = "open aprilsh:" AprishMsgClose = "close aprilsh:" AprilshPackageName = "aprilsh" CommandServerName = "apshd" CommandClientName = "apsh" TimeoutIfNoResp = 60000 TimeoutIfNoConnect = 15000 VersionInfo = `` /* 283-byte string literal not displayed */ )
const ( SEND_INTERVAL_MIN = 20 /* ms between frames */ SEND_INTERVAL_MAX = 250 /* ms between frames */ ACK_INTERVAL = 3000 /* ms between empty acks */ ACK_DELAY = 100 /* ms before delayed ack */ SHUTDOWN_RETRIES = 16 /* number of shutdown packets to send before giving up */ ACTIVE_RETRY_TIMEOUT = 10000 /* attempt to resend at frame rate */ )
const ( SRTT_TRIGGER_LOW = 20 // <= ms cures SRTT trigger to show predictions SRTT_TRIGGER_HIGH = 30 // > ms starts SRTT trigger FLAG_TRIGGER_LOW = 50 // <= ms cures flagging FLAG_TRIGGER_HIGH = 80 // > ms starts flagging GLITCH_THRESHOLD = 250 // prediction outstanding this long is glitch GLITCH_REPAIR_COUNT = 10 // non-glitches required to cure glitch trigger GLITCH_REPAIR_MININTERVAL = 150 // required time in between non-glitches GLITCH_FLAG_THRESHOLD = 5000 // prediction outstanding this long => underline )
const (
MAX_SIGNAL_NUMBER = 64
)
Variables ¶
var ( GitTag string // build version GoVersion string // Go version BuildTime string // build time GitCommit string // git commit id GitBranch string // git branch name DefaultPort = 8100 // https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers )
Functions ¶
func PrintUsage ¶
func PrintVersion ¶
func PrintVersion()
func ReadFromFile ¶
Read from the reader, set read time out for every read. The read result will be sent to caller via msgChan, including error info if available. doneChan channel is used to stop the file reader.
Note the caller should consume the last read message when shutdown.
func ReadFromNetwork ¶
func ReadFromNetwork(timeout int, msgChan chan Message, doneChan chan any, connection Connection)
Read from the network, set read time out before every read. The read result will be sent to caller via msgChan, including error info if available. doneChan channel is used to stop the network receiver.
Note the caller should consume the last read message when shutdown. connection closed error will stop the function.
Types ¶
type Connection ¶
for easy mock
type DisplayPreference ¶
type DisplayPreference uint
const ( DisplayPreferenceUnused DisplayPreference = iota Always Never Adaptive Experimental )
type Message ¶
type Message struct { Data string // payload data RAddr net.Addr // if the message is from network, it's the remote address Err error // error if it happens }
communication the read result with the others
type NotificationEngine ¶
type NotificationEngine struct {
// contains filtered or unexported fields
}
represent the prediction notifications
func (*NotificationEngine) ClearNetworkError ¶
func (ne *NotificationEngine) ClearNetworkError()
func (*NotificationEngine) GetNotificationString ¶
func (ne *NotificationEngine) GetNotificationString() string
func (*NotificationEngine) ServerAcked ¶
func (ne *NotificationEngine) ServerAcked(ts int64)
func (*NotificationEngine) ServerHeard ¶
func (ne *NotificationEngine) ServerHeard(ts int64)
func (*NotificationEngine) SetEscapeKeyString ¶
func (ne *NotificationEngine) SetEscapeKeyString(str string)
func (*NotificationEngine) SetNetworkError ¶
func (ne *NotificationEngine) SetNetworkError(str string)
func (*NotificationEngine) SetNotificationString ¶
func (ne *NotificationEngine) SetNotificationString(message string, permanent bool, showQuitKeystroke bool)
default parameters: permanent = false, showQuitKeystroke = true
type OverlayManager ¶
type OverlayManager struct {
// contains filtered or unexported fields
}
func NewOverlayManager ¶
func NewOverlayManager() *OverlayManager
func (*OverlayManager) Apply ¶
func (om *OverlayManager) Apply(emu *terminal.Emulator)
func (*OverlayManager) GetNotificationEngine ¶
func (om *OverlayManager) GetNotificationEngine() *NotificationEngine
func (*OverlayManager) GetPredictionEngine ¶
func (om *OverlayManager) GetPredictionEngine() *PredictionEngine
func (*OverlayManager) SetTitlePrefix ¶
func (om *OverlayManager) SetTitlePrefix(v string)
func (*OverlayManager) WaitTime ¶
func (om *OverlayManager) WaitTime() int
type PredictionEngine ¶
type PredictionEngine struct {
// contains filtered or unexported fields
}
represent the prediction engine, which contains prediction cursor movement and prediction rows and cells.
func (*PredictionEngine) NewUserInput ¶
func (pe *PredictionEngine) NewUserInput(emu *terminal.Emulator, input []rune)
process user input to prepare local prediction:cells and cursors. before process the input, PredictionEngine calls cull() method to check the prediction validity. a.k.a mosh new_user_byte() method
func (*PredictionEngine) Reset ¶
func (pe *PredictionEngine) Reset()
clean all the cursor predictions and all the cell predictions. increase the epoch.
func (*PredictionEngine) SetDisplayPreference ¶
func (pe *PredictionEngine) SetDisplayPreference(v DisplayPreference)
func (*PredictionEngine) SetLocalFrameAcked ¶
func (pe *PredictionEngine) SetLocalFrameAcked(v uint64)
func (*PredictionEngine) SetLocalFrameLateAcked ¶
func (pe *PredictionEngine) SetLocalFrameLateAcked(v uint64)
func (*PredictionEngine) SetLocalFrameSent ¶
func (pe *PredictionEngine) SetLocalFrameSent(v uint64)
func (*PredictionEngine) SetPredictOverwrite ¶
func (pe *PredictionEngine) SetPredictOverwrite(overwrite bool)
func (*PredictionEngine) SetSendInterval ¶
func (pe *PredictionEngine) SetSendInterval(value uint)
type Signals ¶
type Signals [MAX_SIGNAL_NUMBER]atomic.Int32
func (*Signals) AnySignal ¶
Check whether we got any signal. This method DOES NOT consumes any signal notification.
type TitleEngine ¶
type TitleEngine struct {
// contains filtered or unexported fields
}
represent the prediction title prefix.