Documentation ¶
Index ¶
- Constants
- Variables
- type AdminMessage
- func (am *AdminMessage) AsBytes() []byte
- func (am *AdminMessage) DecryptAdminPassword(sysclientPassword string, seed string, pwd string) ([]byte, error)
- func (am *AdminMessage) GetLoginDigest(id, product, version, challenge, password string) (string, error)
- func (am *AdminMessage) HandleAdminReceiveChallenge(secretKey []byte, deviceInfo *Identity, fileSysclientpassword string) (*AdminMessage, error)
- func (am *AdminMessage) HandleAdminReceiveSysclientPassword(secretKey []byte, fileSysclientpassword string) error
- type AdministrativePassword
- type Challenge
- type EthIf
- type HttpResponseWriter
- type Identity
- type Password
- type Platform
- type Sysclient
- func (sc *Sysclient) Connect() error
- func (sc *Sysclient) HandleAdminMessage(messageIn *AdminMessage) (*AdminMessage, error)
- func (sc *Sysclient) Printf(format string, a ...interface{})
- func (sc *Sysclient) Println(v ...any)
- func (sc *Sysclient) ReadWriteLoop() error
- func (sc *Sysclient) Send(message []byte) error
- type SysclientTunnel
- func (tunnel *SysclientTunnel) GetNextChunk() ([]byte, error)
- func (tunnel *SysclientTunnel) HandleRequest(message *TunnelMessage) (*TunnelMessage, error)
- func (tunnel *SysclientTunnel) HandleTunnelReceive(message *TunnelMessage) (*TunnelMessage, error)
- func (tunnel *SysclientTunnel) HandleTunnelSend(message *TunnelMessage) (*TunnelMessage, error)
- type TunnelMessage
Constants ¶
View Source
const (
MessageTypeAdmin byte = 0x01
)
Sysclient message header
Variables ¶
View Source
var ( MessageTypeTunnel byte = 0x02 TunnelSend []byte = []byte{0x00, 0x00, 0x00, 0x00} // socket send TunnelReceive []byte = []byte{0x00, 0x00, 0x00, 0x01} // socket receive TunnelReceiveResult []byte = []byte{0x00, 0x00, 0x00, 0x02} // receive result TunnelSendResult []byte = []byte{0x00, 0x00, 0x00, 0x03} // socket send result TunnelShutdown []byte = []byte{0x00, 0x00, 0x00, 0x04} // socket shutdown )
Sysclient message header
View Source
var AdminConfiguration []byte = []byte{0x00, 0x06} // Configuration
View Source
var AdminProvision []byte = []byte{0x00, 0x04} // Provision
View Source
var AdminProvisionResult []byte = []byte{0x00, 0x05} // Provision result
View Source
var AdminReceiveChallenge []byte = []byte{0x00, 0x02} // Receive challenge
View Source
var AdminReceiveNewAdminPassword []byte = []byte{0x00, 0x03} // Receive new administrative password
View Source
var AdminReceiveSysclientPassword []byte = []byte{0x00, 0x01} // Receive sysclient password
View Source
var AdminSendIdentify []byte = []byte{0x00, 0x00} // Send identify
Admin message header
Functions ¶
This section is empty.
Types ¶
type AdminMessage ¶
type AdminMessage struct { Type byte Command []byte // 2 bytes Data []byte // the rest of the data }
func NewAdminMessage ¶
func NewAdminMessage(message []byte) (*AdminMessage, error)
func (*AdminMessage) AsBytes ¶
func (am *AdminMessage) AsBytes() []byte
func (*AdminMessage) DecryptAdminPassword ¶
func (*AdminMessage) GetLoginDigest ¶
func (am *AdminMessage) GetLoginDigest(id, product, version, challenge, password string) (string, error)
func (*AdminMessage) HandleAdminReceiveChallenge ¶
func (am *AdminMessage) HandleAdminReceiveChallenge(secretKey []byte, deviceInfo *Identity, fileSysclientpassword string) (*AdminMessage, error)
func (*AdminMessage) HandleAdminReceiveSysclientPassword ¶
func (am *AdminMessage) HandleAdminReceiveSysclientPassword(secretKey []byte, fileSysclientpassword string) error
receives the sysclient password and stores it. no answer is required
type AdministrativePassword ¶
func NewAdministrativePassword ¶
func NewAdministrativePassword(json_bytes []byte) (*AdministrativePassword, error)
type HttpResponseWriter ¶
type HttpResponseWriter struct {
// contains filtered or unexported fields
}
Define a HttpResponseWriter ResponseWriter
func (*HttpResponseWriter) GetBytes ¶
func (w *HttpResponseWriter) GetBytes() []byte
func (*HttpResponseWriter) Header ¶
func (w *HttpResponseWriter) Header() http.Header
func (*HttpResponseWriter) WriteHeader ¶
func (w *HttpResponseWriter) WriteHeader(status int)
type Identity ¶
type Identity struct { Id string `json:"id"` Product string `json:"product"` Version string `json:"version"` FwBuild string `json:"fwBuild"` BcBuild string `json:"bcBuild"` Major string `json:"major"` Fw string `json:"fw"` Bc string `json:"bc"` Mini bool `json:"mini"` PbxActive bool `json:"pbxActive"` Other bool `json:"other"` Platform Platform `json:"platform"` Digest string `json:"digest,omitempty"` EthIfs []EthIf `json:"ethIfs,omitempty"` // up to 3 eth interfaces are allowed. }
func NewIdentity ¶
type Sysclient ¶
type Sysclient struct { Identity Identity Url string Timeout time.Duration InsecureSkipVerify bool Context context.Context Conn *websocket.Conn Tunnels map[int32]*SysclientTunnel // map of active tunnels indexed by the sessionid ServeMux *http.ServeMux // the instance of the Http Server Mux to handle Http Requests FileSysclientPassword string // filename to store FileAdministrativePassword string // filename to store SecretKey []byte // key to encrypt the local files as []bytes }
func NewSysclient ¶
func (*Sysclient) HandleAdminMessage ¶
func (sc *Sysclient) HandleAdminMessage(messageIn *AdminMessage) (*AdminMessage, error)
func (*Sysclient) ReadWriteLoop ¶
type SysclientTunnel ¶
type SysclientTunnel struct { ServeMux *http.ServeMux SessionId []byte Response []byte ResponseChunks [][]byte }
func NewSysclientTunnel ¶
func NewSysclientTunnel(session []byte, servermux *http.ServeMux) (*SysclientTunnel, error)
func (*SysclientTunnel) GetNextChunk ¶
func (tunnel *SysclientTunnel) GetNextChunk() ([]byte, error)
func (*SysclientTunnel) HandleRequest ¶
func (tunnel *SysclientTunnel) HandleRequest(message *TunnelMessage) (*TunnelMessage, error)
func (*SysclientTunnel) HandleTunnelReceive ¶
func (tunnel *SysclientTunnel) HandleTunnelReceive(message *TunnelMessage) (*TunnelMessage, error)
in:
TunnelReceive 02 0000000d 00000001 00000000
out:
TunnelReceiveResult 02 0000000d 00000002 485454502f312e3120323030204f4b0d0a436f6e74656e742d547970653a206170706c69636174696f6e2f6a6176617363726970740d0a…
func (*SysclientTunnel) HandleTunnelSend ¶
func (tunnel *SysclientTunnel) HandleTunnelSend(message *TunnelMessage) (*TunnelMessage, error)
the sysclient server is requesting data with http data
in: TunnelSend 02 0000000d 00000000 474554202f7374617469632f6a732f706167652e6a7320485454502f312e310d0a486f73743a20617070732e667269747a2e626f780d0a…] out: TunnelSendResult 02 0000000d 00000003
type TunnelMessage ¶
type TunnelMessage struct { Type byte SessionId []byte // 4 bytes EventType []byte // 4 bytes Data []byte // rest of the bytes }
SMT | Byte offset
| 0 1 2 3 4 5 6 7 8 9 ... +------+------+------+------+------+------+------+------+------+------+------+ 2 | | Session-ID | Event-Type | Data..... +------+------+------+------+------+------+------+------+------+------+------+
func NewTunnelMessage ¶
func NewTunnelMessage(message []byte) (*TunnelMessage, error)
func (*TunnelMessage) AsBytes ¶
func (tm *TunnelMessage) AsBytes() []byte
func (*TunnelMessage) GetSessionId ¶
func (tm *TunnelMessage) GetSessionId() (int32, error)
Click to show internal directories.
Click to hide internal directories.