github.com/aitjcize/Overlord@v0.0.0-20240314041920-104a804cf5e8/overlord/constants.go (about)

     1  // Copyright 2015 The Chromium OS Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  
     5  package overlord
     6  
     7  // Overlord server ports.
     8  var (
     9  	OverlordLDPort   = GetenvInt("OVERLORD_LD_PORT", 4456) // LAN discovery port
    10  	DefaultHTTPPort  = 80
    11  	DefaultHTTPSPort = 443
    12  )
    13  
    14  const (
    15  	pingTimeout = 10
    16  )
    17  
    18  // ConnServer Client mode
    19  const (
    20  	ModeNone = iota
    21  	ModeControl
    22  	ModeTerminal
    23  	ModeShell
    24  	ModeLogcat
    25  	ModeFile
    26  	ModeForward
    27  )
    28  
    29  // Logcat format
    30  const (
    31  	logcatTypeText = iota
    32  	logcatTypeVT100
    33  )
    34  
    35  // RPC states
    36  const (
    37  	Success = "success"
    38  	Failed  = "failed"
    39  )
    40  
    41  // Stream control
    42  const (
    43  	StdinClosed = "##STDIN_CLOSED##"
    44  )
    45  
    46  // ModeStr translate client mode to string.
    47  func ModeStr(mode int) string {
    48  	return map[int]string{
    49  		ModeNone:     "None",
    50  		ModeControl:  "Agent",
    51  		ModeTerminal: "Terminal",
    52  		ModeShell:    "Shell",
    53  		ModeLogcat:   "Logcat",
    54  		ModeFile:     "File",
    55  		ModeForward:  "ModeForward",
    56  	}[mode]
    57  }