teogw

package module
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 11 Imported by: 5

README

Teonet gateway

Teogw is Teonet tru gateway application which get request by tru, execute it in teonet and send responce back to tru. The tequest format is: {id, address, command, data}

Licence

BSD

Documentation

Overview

Teogw client connection and processing package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Teogw

type Teogw struct {
	*tru.Tru
	// contains filtered or unexported fields
}

Teogw structure and methods receiver

func Connect

func Connect(addr string, params ...interface{}) (t *Teogw, err error)

Create tru and start listen on port and connect to tru channel

func New

func New(port int, log *teolog.Teolog, params ...interface{}) (t *Teogw, err error)

Create tru and start listen on port

func (*Teogw) Send

func (t *Teogw) Send(address, command string, data []byte) (pacid uint32, err error)

Send command to to teonet address

func (*Teogw) Wait

func (t *Teogw) Wait(address string, id uint32) (data []byte, err error)

Wait answer from teonet address by id or timeout

type TeogwData

type TeogwData struct {
	ID      uint32 `json:"id"`
	Address string `json:"address"`
	Command string `json:"command"`
	Data    []byte `json:"data"`
	Err     string `json:"err"`
}

Teogw packet data

func (TeogwData) GetAddress added in v0.6.4

func (gw TeogwData) GetAddress() string

Get address

func (TeogwData) GetCommand added in v0.6.4

func (gw TeogwData) GetCommand() string

Get command

func (TeogwData) GetData added in v0.6.4

func (gw TeogwData) GetData() []byte

Get data

func (TeogwData) GetID added in v0.6.4

func (gw TeogwData) GetID() uint32

Get ID

func (*TeogwData) MarshalBinary

func (gw *TeogwData) MarshalBinary() (out []byte, err error)

MarshalBinary marshal Teogw binary packet

func (TeogwData) MarshalJson added in v0.6.4

func (gw TeogwData) MarshalJson(
	gwData teowebrtc_server.WebRTCData,
	command string, inData []byte, inErr error) ([]byte, error)

Marshal TeogwData to Json

func (*TeogwData) SetCommand added in v0.6.4

func (gw *TeogwData) SetCommand(command string)

Set data

func (*TeogwData) SetData

func (gw *TeogwData) SetData(data []byte)

Set data

func (*TeogwData) SetError

func (gw *TeogwData) SetError(err error)

Set error

func (*TeogwData) SetID

func (gw *TeogwData) SetID(id uint32)

Set id

func (*TeogwData) UnmarshalBinary

func (gw *TeogwData) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary unmarshal Teogw binary packet

func (TeogwData) UnmarshalJson added in v0.6.4

func (gw TeogwData) UnmarshalJson(data []byte) (teowebrtc_server.WebRTCData, error)

Unmarshal Json and return TeogwData

Directories

Path Synopsis
cmd
teogw command
Teogw teonet application get request by tru, execute it in teonet and send responce back by tru.
Teogw teonet application get request by tru, execute it in teonet and send responce back by tru.
teogwcli command
Teogw client sample apllication
Teogw client sample apllication

Jump to

Keyboard shortcuts

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