wcwebcamclient_go

package module
v0.0.0-...-9c8ffda Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 15 Imported by: 0

README

wcWebCamClient Go Module

This is a library for convenient client work with the wcWebCamServer server via the JSON protocol.

The structure of the client-server software package

The server designed to collect images and data streams from cameras (devices) and forwards messages between devices to control the periphery via an HTTP 2 connection is wcwebcamserver (Lazarus/Free Pascal). Library for a C/C++ client is wcwebcamclient (C/C++). Abstract client for Lazarus is wccurlclient (Lazarus/Free Pascal). A detailed implementation of an external device based on "ESP32-CAM" is given in the example webcamdevice (С). The example of a desktop application for external device controlling and viewing images is webcamclientviewer (Lazarus). An example of an Android application for controlling external devices, chatting and streaming is wcwebcameracontrol (Java).

Usage

Use go get -u to download and install the prebuilt package.

go get -u github.com/ilya2ik/wcwebcamclient_go

or

go install github.com/ilya2ik/wcwebcamclient_go@latest
Example for in/out streaming
/* Streaming files from a folder as a set of frames  */

package main

import (
   "bytes"
   "encoding/binary"
   "flag"
   "fmt"
   "os"
   "strings"
   "sync"
   "time"

   wclib "github.com/ilya2ik/wcwebcamclient_go"
)

/* Relative path to files */
const TO_SEND_FOLDER = "tosend"

/* The max delta time between two frames in milliseconds */
const MAX_DELTA = 600

/* The total program timeout in seconds */
const TIME_OUT = 600

type appStatus int

const (
   StatusWaiting appStatus = iota
   StatusAuthorized
   StatusIOStarted
   StatusIOFinished
   StatusError
)

type appStreamStruct struct {
   mux              sync.Mutex
   frames           []string
   cur_frame        int
   status           appStatus
   mem_frame_buffer *bytes.Buffer
   sequence         chan *appStreamStruct
}

func (app *appStreamStruct) Lock() {
   app.mux.Lock()
}

func (app *appStreamStruct) Unlock() {
   app.mux.Unlock()
}

func (app *appStreamStruct) SetStatus(st appStatus) {
   app.Lock()
   defer app.Unlock()

   if st != app.status {
      app.status = st
      app.sequence <- app
   }
}

func (app *appStreamStruct) GetStatus() appStatus {
   app.Lock()
   defer app.Unlock()

   return app.status
}

func (app *appStreamStruct) FramesCount() int {
   app.Lock()
   defer app.Unlock()

   return len(app.frames)
}

func (app *appStreamStruct) CurFrame() string {
   app.Lock()
   defer app.Unlock()

   return app.frames[app.cur_frame]
}

func (app *appStreamStruct) NextFrame() {
   app.Lock()
   defer app.Unlock()

   app.cur_frame++
   if app.cur_frame >= len(app.frames) {
      app.cur_frame = 0
   }
}

var appStream = appStreamStruct{
   status:           StatusWaiting,
   mem_frame_buffer: bytes.NewBuffer(make([]byte, 0)),
   sequence:         make(chan *appStreamStruct, 16),
}

/* Read file to memory */
func raw_read(pathname string) error {

   fp, err := os.Open(pathname)
   if err != nil {
      return err
   }

   defer fp.Close()

   fi, err := fp.Stat()
   if err != nil {
      return err
   }

   var fsize uint32 = uint32(fi.Size())

   appStream.Lock()
   defer appStream.Unlock()

   appStream.mem_frame_buffer.Reset()

   frame_buffer := (((fsize + uint32(wclib.WC_STREAM_FRAME_HEADER_SIZE)) >> 12) + 1) << 12
   if appStream.mem_frame_buffer.Cap() < int(fsize) {
      appStream.mem_frame_buffer.Grow(int(frame_buffer))
   }
   binary.Write(appStream.mem_frame_buffer, binary.LittleEndian, wclib.WC_FRAME_START_SEQ)
   binary.Write(appStream.mem_frame_buffer, binary.LittleEndian, fsize)
   _, err = appStream.mem_frame_buffer.ReadFrom(fp)
   if err != nil {
      return err
   }

   return nil
}

func AuthSuccess(tsk wclib.ITask) {
   fmt.Println("SID ", tsk.GetClient().GetSID())
   appStream.SetStatus(StatusAuthorized)
}

/* Callback. IO stream closed. */
func onIOTaskFinished(tsk wclib.ITask) {
   fmt.Println("Output stream closed")
   appStream.SetStatus(StatusIOFinished)
}

/* Callback. IO stream started. */
func onIOTaskStarted(tsk wclib.ITask) {
   fmt.Println("Output stream started")
   appStream.SetStatus(StatusIOStarted)
}

func check(e error) {
   if e != nil {
      panic(e)
   }
}

func main() {
   flag.Parse()

   cfg := wclib.ClientCfgNew()
   check(cfg.SetHostURL("https://username:password@localhost:8080"))
   cfg.SetDevice("device_to_listen")

   c, err := wclib.ClientNew(cfg)
   check(err)
   c.SetOnAuthSuccess(AuthSuccess)

   c.SetOnAfterLaunchOutStream(onIOTaskStarted)
   c.SetOnSuccessIOStream(onIOTaskFinished)

   fmt.Println("Trying to start client")
   check(c.Start())

   start_ts := time.Now().UnixMilli()
   frame_start_ts := start_ts

   for loop := true; loop; {

      switch c.GetClientStatus() {
      case wclib.StateConnectedWrongSID:
         {
            fmt.Println("Trying to authorize")
            check(c.AuthFromHostUrl())
         }
      case wclib.StateDisconnected:
         {
            loop = false
            break
         }
      default:
         {
            select {
            case v := <-appStream.sequence:
               {
                  switch st := v.GetStatus(); st {
                  case StatusError:
                     {
                        fmt.Println("Some error occurred")
                        c.Disconnect()
                     }
                  case StatusAuthorized:
                     {
                        files, err := os.ReadDir(TO_SEND_FOLDER)
                        if err != nil {
                           check(err)
                        }

                        for _, f := range files {
                           if strings.HasSuffix(strings.ToUpper(f.Name()), ".RAW") {
                              appStream.frames =
                                            append(appStream.frames,
                                                    TO_SEND_FOLDER+"/"+f.Name())
                           }
                        }

                        if appStream.FramesCount() == 0 {
                           fmt.Println("No frames found")
                           appStream.SetStatus(StatusError)
                        }

                        go func() {
                           fmt.Println("Starting output stream...")
                           if err := c.LaunchOutStream("RAW", MAX_DELTA, nil); err != nil {
                              fmt.Printf("Error on starting stream: %v\n", err)
                              appStream.SetStatus(StatusError)
                           }
                        }()
                     }
                  case StatusIOStarted:
                     {
                        cur_ts := time.Now().UnixMilli()

                        timeout := cur_ts - frame_start_ts

                        if timeout >= MAX_DELTA {
                           frame_start_ts = cur_ts
                           go func() {
                              check(raw_read(appStream.CurFrame()))
                              appStream.NextFrame()

                              appStream.Lock()
                              defer appStream.Unlock()
                              buf := appStream.mem_frame_buffer
                              if buf.Len() > 0 {
                                 appStream.mem_frame_buffer = bytes.NewBuffer(make([]byte, 0))
                                 fmt.Println("Next frame sended")
                                 c.PushOutData(buf)
                              }
                              appStream.sequence <- &appStream
                           }()
                        } else {
                           time.Sleep(10 * time.Millisecond)
                           appStream.sequence <- &appStream
                        }
                     }
                  case StatusIOFinished:
                     {
                        fmt.Println("Process fully finished")
                        c.Disconnect()
                     }
                  }
               }
            default:
               time.Sleep(250 * time.Millisecond)
               cur_ts := time.Now().UnixMilli()

               if (cur_ts-start_ts)/1000 > TIME_OUT {
                  fmt.Println("Timeout")
                  appStream.SetStatus(StatusIOFinished)
               }
            }
         }
      }

   }

   close(appStream.sequence)

   fmt.Println("Client finished")
}
/* Streaming of the incoming data.
   Frames are extracted from the stream and
   saved in OUTPUT_FOLDER in separate files  */

package main

import (
   "bytes"
   "fmt"
   "os"
   "sync"
   "time"

   wclib "github.com/ilya2ik/wcwebcamclient_go"
)

/* Relative path to save output data */
const OUTPUT_FOLDER = "output"

/* The total program timeout in seconds */
const TIME_OUT = 60

type appStatus int

const (
   StatusWaiting appStatus = iota
   StatusAuthorized
   StatusStreamDetected
   StatusIOStarted
   StatusIOFinished
   StatusError
)

type appStreamStruct struct {
   mux              sync.Mutex
   deltaTime        int
   curFrame         int
   status           appStatus
   mem_frame_buffer *bytes.Buffer
   sequence         chan *appStreamStruct
}

func (app *appStreamStruct) Lock() {
   app.mux.Lock()
}

func (app *appStreamStruct) Unlock() {
   app.mux.Unlock()
}

func (app *appStreamStruct) SetStatus(st appStatus) {
   app.Lock()
   defer app.Unlock()

   if st != app.status {
      app.status = st
      app.sequence <- app
   }
}

func (app *appStreamStruct) GetStatus() appStatus {
   app.Lock()
   defer app.Unlock()

   return app.status
}

var appStream = appStreamStruct{
   status:           StatusWaiting,
   mem_frame_buffer: bytes.NewBuffer(make([]byte, 0)),
   sequence:         make(chan *appStreamStruct, 16),
   deltaTime:        1000,
}

func AuthSuccess(tsk wclib.ITask) {
   fmt.Println("SID ", tsk.GetClient().GetSID())
   appStream.SetStatus(StatusAuthorized)
}

func OnUpdateStreams(tsk wclib.ITask, jsonobj []map[string]any) {
   for _, jStrm := range jsonobj {
      var aStrm wclib.StreamStruct
      err := aStrm.JSONDecode(jStrm)
      check(err)

      if aStrm.Device == "device_to_listen" {
         fmt.Printf("Stream detected `%s`; subproto: `%s`; delta: %d\n",
            aStrm.Device, aStrm.SubProto, int(appStream.deltaTime))
         appStream.deltaTime = int(aStrm.Delta)
         appStream.SetStatus(StatusStreamDetected)
         return
      }
   }
   fmt.Println("Streaming device is not online. Retry")
   appStream.sequence <- &appStream
}

/* Callback. IO stream closed. */
func onIOTaskFinished(tsk wclib.ITask) {
   fmt.Println("Output stream closed")
   appStream.SetStatus(StatusIOFinished)
}

func onNextFrame(tsk wclib.ITask) {
   fmt.Println("New frame captured")
   appStream.sequence <- &appStream
}

func check(e error) {
   if e != nil {
      panic(e)
   }
}

func main() {
   cfg := wclib.ClientCfgNew()
   check(cfg.SetHostURL("https://user:password@localhost:8080"))
   cfg.SetDevice("test")

   c, err := wclib.ClientNew(cfg)
   check(err)
   c.SetOnAuthSuccess(AuthSuccess)
   c.SetOnUpdateStreams(OnUpdateStreams)
   c.SetOnSuccessIOStream(onIOTaskFinished)

   fmt.Println("Trying to start client")
   check(c.Start())

   var start_ts int64

   for loop := true; loop; {

      switch c.GetClientStatus() {
      case wclib.StateConnectedWrongSID:
         {
            fmt.Println("Trying to authorize")
            check(c.AuthFromHostUrl())
         }
      case wclib.StateDisconnected:
         {
            loop = false
            break
         }
      default:
         {
            select {
            case v := <-appStream.sequence:
               {
                  switch st := v.GetStatus(); st {
                  case StatusError:
                     {
                        fmt.Println("Some error occurred")
                        c.Disconnect()
                     }
                  case StatusAuthorized:
                     {
                        check(c.UpdateStreams(nil))
                     }
                  case StatusStreamDetected:
                     {
                        start_ts = time.Now().UnixMilli()
                        go func() {
                           fmt.Println("Starting incoming stream...")
                           if err := c.LaunchInStream("device_to_listen", onNextFrame, nil); err != nil {
                              fmt.Printf("Error on starting stream: %v\n", err)
                              appStream.SetStatus(StatusError)
                           } else {
                              appStream.SetStatus(StatusIOStarted)
                           }
                        }()
                     }
                  case StatusIOStarted:
                     {
                        fr, err := c.PopInFrame()
                        if err != nil {
                           fmt.Printf("Error on frame extract: %v\n", err)
                           appStream.SetStatus(StatusError)
                        }

                        go func(frame *bytes.Buffer) {
                           outfile, err := os.Create(
                              fmt.Sprintf("%s/frame%05d.raw", OUTPUT_FOLDER, appStream.curFrame))
                           if err != nil {
                              appStream.SetStatus(StatusError)
                              panic(err)
                           }

                           appStream.curFrame++

                           defer outfile.Close()

                           _, err = frame.WriteTo(outfile)

                           if err != nil {
                              appStream.SetStatus(StatusError)
                              panic(err)
                           }
                        }(fr)
                     }
                  case StatusIOFinished:
                     {
                        fmt.Println("Process fully finished")
                        c.Disconnect()
                     }
                  }
               }
            default:
               time.Sleep(time.Duration(appStream.deltaTime) * time.Millisecond)
               cur_ts := time.Now().UnixMilli()

               if (cur_ts-start_ts)/1000 > TIME_OUT {
                  fmt.Println("Timeout")
                  appStream.SetStatus(StatusIOFinished)
               }
            }
         }
      }

   }

   close(appStream.sequence)

   fmt.Println("Client finished")
}

Documents

wcWebCamClient library API User's Guide - Doxygen

Documentation

Index

Constants

View Source
const DATABASE_FAIL = 3
View Source
const EMPTY_REQUEST = 11
View Source
const ERRORED_STREAM = 14
View Source
const INTERNAL_UNKNOWN_ERROR = 2
View Source
const JSON_FAIL = 5
View Source
const JSON_PARSER_FAIL = 4
View Source
const JSON_RPC_BAD string = "BAD"
View Source
const JSON_RPC_CODE string = "code"
View Source
const JSON_RPC_CONFIG string = "config"
View Source
const JSON_RPC_DELTA string = "delta"
View Source
const JSON_RPC_DESCR string = "descr"
View Source
const JSON_RPC_DEVICE string = "device"
View Source
const JSON_RPC_DEVICES string = "devices"
View Source
const JSON_RPC_DV string = "dv"
View Source
const JSON_RPC_FV string = "fv"
View Source
const JSON_RPC_KIND string = "kind"
View Source
const JSON_RPC_MAV string = "mav"
View Source
const JSON_RPC_META string = "meta"
View Source
const JSON_RPC_MID string = "mid"
View Source
const JSON_RPC_MIV string = "miv"
View Source
const JSON_RPC_MSG string = "msg"
View Source
const JSON_RPC_MSGS string = "msgs"
View Source
const JSON_RPC_NAME string = "name"
View Source
const JSON_RPC_OK string = "OK"
View Source
const JSON_RPC_PARAMS string = "params"
View Source
const JSON_RPC_PASS string = "pass"
View Source
const JSON_RPC_RECORDS string = "records"
View Source
const JSON_RPC_RESULT string = "result"
View Source
const JSON_RPC_RID string = "rid"
View Source
const JSON_RPC_SHASH string = "shash"
View Source
const JSON_RPC_STAMP string = "stamp"
View Source
const JSON_RPC_SUBPROTO string = "subproto"
View Source
const JSON_RPC_SYNC string = "sync"
View Source
const JSON_RPC_TARGET string = "target"
View Source
const MALFORMED_REQUEST = 12
View Source
const NO_CHANNEL = 13
View Source
const NO_DATA_RETURNED = 10
View Source
const NO_DEVICES_ONLINE = 8
View Source
const NO_ERROR = 0
View Source
const NO_SUCH_DEVICE = 15
View Source
const NO_SUCH_RECORD = 9
View Source
const NO_SUCH_SESSION = 6
View Source
const NO_SUCH_USER = 7
View Source
const REST_SYNC_MSG string = "{\"msg\":\"sync\"}"
View Source
const UNSPECIFIED = 1
View Source
const WC_FRAME_BUFFER_INIT_SIZE int64 = 4096

The initial frame buffer size

View Source
const WC_FRAME_BUFFER_SIZE int64 = 0x200000

The frame buffer size (the maximum size of one frame)

View Source
const WC_FRAME_START_SEQ uint16 = 0xaaaa

The frame header sequence

View Source
const WC_STREAM_FRAME_HEADER_SIZE uint16 = 6

The size of frame header (6 bytes)

Variables

View Source
var RESPONSE_ERRORS = [...]string{
	"NO_ERROR",
	"UNSPECIFIED",
	"INTERNAL_UNKNOWN_ERROR",
	"DATABASE_FAIL",
	"JSON_PARSER_FAIL",
	"JSON_FAIL",
	"NO_SUCH_SESSION",
	"NO_SUCH_USER",
	"NO_DEVICES_ONLINE",
	"NO_SUCH_RECORD",
	"NO_DATA_RETURNED",
	"EMPTY_REQUEST",
	"MALFORMED_REQUEST",
	"NO_CHANNEL",
	"ERRORED_STREAM",
	"NO_SUCH_DEVICE"}

Functions

func ClientStatusText

func ClientStatusText(status ClientStatus) string

func JSONDecode

func JSONDecode(jsonmap map[string]any, dest any) error

You can use JSONHelper methods to convert json maps to structs. The methods are not efficient and applyable only for testing proposes. You can use other external suitable modules to work with JSON maps and convert to structs vise versa

Types

type BoolThreadSafe

type BoolThreadSafe struct {
	Value bool
	// contains filtered or unexported fields
}

func (*BoolThreadSafe) GetValue

func (c *BoolThreadSafe) GetValue() bool

func (*BoolThreadSafe) SetValue

func (c *BoolThreadSafe) SetValue(val bool) bool

type ClientState

type ClientState int
const STATE_CONFIG ClientState = 23
const STATE_CONNECTION ClientState = 0
const STATE_DEVICENAME ClientState = 12
const STATE_DEVICES ClientState = 6
const STATE_ERROR ClientState = 2
const STATE_HOSTNAME ClientState = 14
const STATE_LOG ClientState = 3
const STATE_METADATA ClientState = 11
const STATE_MSGS ClientState = 9
const STATE_MSGSSTAMP ClientState = 10
const STATE_PROXY ClientState = 15
const STATE_PROXYAUTH ClientState = 16
const STATE_PROXYHOST ClientState = 18
const STATE_PROXYPORT ClientState = 19
const STATE_PROXYPROTOCOL ClientState = 17
const STATE_PROXYPWRD ClientState = 21
const STATE_PROXYUSER ClientState = 20
const STATE_RECORDS ClientState = 7
const STATE_RECORDSSTAMP ClientState = 8
const STATE_SENDWITHSYNC ClientState = 22
const STATE_SID ClientState = 13
const STATE_STREAMING ClientState = 4
const STATE_STREAMS ClientState = 5
const STATE_VERIFYTLS ClientState = 1

type ClientStatus

type ClientStatus int
const (
	StateWaiting ClientStatus = iota
	StateConnectedWrongSID
	StateConnectedAuthorization
	StateConnected
	StateDisconnected
)

type ClientStatusThreadSafe

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

type ConfigElementStruct

type ConfigElementStruct struct {
	Kind         float64 `json:"kind"`
	Description  string  `json:"descr"`
	MinValue     float64 `json:"miv"`
	MaxValue     float64 `json:"mav"`
	DefaultValue float64 `json:"dv"`
	CurValue     float64 `json:"fv"`
}

func (*ConfigElementStruct) JSONDecode

func (mr *ConfigElementStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the ConfigElementStruct

type ConnNotifyEventFunc

type ConnNotifyEventFunc func(client *WCClient, status ClientStatus)

type DataNotifyEventFunc

type DataNotifyEventFunc func(tsk ITask, data *bytes.Buffer)

type DeviceStruct

type DeviceStruct struct {
	Device string `json:"device"`
	Meta   string `json:"meta"`
}

func (*DeviceStruct) JSONDecode

func (mr *DeviceStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the DeviceStruct

type EMalformedKind

type EMalformedKind int
const (
	EMKWrongType EMalformedKind = iota
	EMKFieldExpected
	EMKUnexpectedValue
)

type EmptyNotifyFunc

type EmptyNotifyFunc func(client *WCClient)

type ErrAuth

type ErrAuth struct{}

func ThrowErrAuth

func ThrowErrAuth() *ErrAuth

func (*ErrAuth) Error

func (*ErrAuth) Error() string

type ErrBadResponse

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

func ThrowErrBadResponse

func ThrowErrBadResponse(code int) *ErrBadResponse

func (*ErrBadResponse) Error

func (e *ErrBadResponse) Error() string

type ErrEmptyResponse

type ErrEmptyResponse struct{}

func ThrowErrEmptyResponse

func ThrowErrEmptyResponse() *ErrEmptyResponse

func (*ErrEmptyResponse) Error

func (*ErrEmptyResponse) Error() string

type ErrHttpStatus

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

func ThrowErrHttpStatus

func ThrowErrHttpStatus(status int) *ErrHttpStatus

func (*ErrHttpStatus) Error

func (e *ErrHttpStatus) Error() string

type ErrLockedConfig

type ErrLockedConfig struct{}

func ThrowErrLockedConfig

func ThrowErrLockedConfig() *ErrLockedConfig

func (*ErrLockedConfig) Error

func (e *ErrLockedConfig) Error() string

type ErrMalformedResponse

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

func ThrowErrMalformedResponse

func ThrowErrMalformedResponse(kind EMalformedKind, arg string, par any) *ErrMalformedResponse

func (*ErrMalformedResponse) Error

func (e *ErrMalformedResponse) Error() string

type ErrNotStreaming

type ErrNotStreaming struct{}

func ThrowErrNotStreaming

func ThrowErrNotStreaming() *ErrNotStreaming

func (*ErrNotStreaming) Error

func (e *ErrNotStreaming) Error() string

type ErrParam

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

func ThrowErrParam

func ThrowErrParam(val any) *ErrParam

func (*ErrParam) Error

func (e *ErrParam) Error() string

type ErrWrongArgument

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

func ThrowErrWrongArgument

func ThrowErrWrongArgument(name string, value any) *ErrWrongArgument

func (*ErrWrongArgument) Error

func (e *ErrWrongArgument) Error() string

type ErrWrongAuthData

type ErrWrongAuthData struct{}

func ThrowErrWrongAuthData

func ThrowErrWrongAuthData() *ErrWrongAuthData

func (*ErrWrongAuthData) Error

func (e *ErrWrongAuthData) Error() string

type ErrWrongConfigElementFormat

type ErrWrongConfigElementFormat struct{}

func ThrowErrWrongConfigElementFormat

func ThrowErrWrongConfigElementFormat() *ErrWrongConfigElementFormat

func (*ErrWrongConfigElementFormat) Error

type ErrWrongHostName

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

func ThrowErrWrongHostName

func ThrowErrWrongHostName(url string) *ErrWrongHostName

func (*ErrWrongHostName) Error

func (e *ErrWrongHostName) Error() string

type ErrWrongOutMsgFormat

type ErrWrongOutMsgFormat struct{}

func ThrowErrWrongOutMsgFormat

func ThrowErrWrongOutMsgFormat() *ErrWrongOutMsgFormat

func (*ErrWrongOutMsgFormat) Error

func (e *ErrWrongOutMsgFormat) Error() string

type ErrWrongStatus

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

func ThrowErrWrongStatus

func ThrowErrWrongStatus(status ClientStatus) *ErrWrongStatus

func (*ErrWrongStatus) Error

func (e *ErrWrongStatus) Error() string

type FramesListThreadSafe

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

func (*FramesListThreadSafe) Clear

func (c *FramesListThreadSafe) Clear()

func (*FramesListThreadSafe) NotEmpty

func (c *FramesListThreadSafe) NotEmpty() bool

func (*FramesListThreadSafe) Pop

func (c *FramesListThreadSafe) Pop() *bytes.Buffer

func (*FramesListThreadSafe) PushBack

func (c *FramesListThreadSafe) PushBack(str *bytes.Buffer)

type ITask

type ITask interface {
	GetClient() *WCClient
	GetUserData() any
	GetKind() TaskKind
	GetLastError() error
	// contains filtered or unexported methods
}

type InStream

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

func (*InStream) Write

func (c *InStream) Write(b []byte) (n int, err error)

func (*InStream) WriteFrom

func (c *InStream) WriteFrom(body io.ReadCloser) error

type JSONArrayNotifyEventFunc

type JSONArrayNotifyEventFunc func(tsk ITask, jsonresult []map[string]any)

type JSONNotifyEventFunc

type JSONNotifyEventFunc func(tsk ITask, jsonresult map[string]any)

type MediaMetaStruct

type MediaMetaStruct struct {
	Device string `json:"device"`
	Meta   string `json:"meta"`
	Stamp  string `json:"stamp"`
}

func (*MediaMetaStruct) JSONDecode

func (mr *MediaMetaStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the MediaMetaStruct

type MediaStruct

type MediaStruct struct {
	Device string  `json:"device"`
	Rid    float64 `json:"rid"`
	Stamp  string  `json:"stamp"`
}

func (*MediaStruct) JSONDecode

func (mr *MediaStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the MediaStruct

type MessageStruct

type MessageStruct struct {
	Device string         `json:"device"`
	Msg    string         `json:"msg"`
	Stamp  string         `json:"stamp"`
	Params map[string]any `json:"params"`
}

func (*MessageStruct) JSONDecode

func (mr *MessageStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the MessageStruct

type NotifyEventFunc

type NotifyEventFunc func(client *WCClient, data any)

type OutConfigElementStruct

type OutConfigElementStruct struct {
	Kind     float64 `json:"kind"`
	CurValue float64 `json:"fv"`
}

func (*OutConfigElementStruct) JSONDecode

func (mr *OutConfigElementStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the OutConfigElementStruct

type OutMessageStruct

type OutMessageStruct struct {
	Target string         `json:"target"`
	Msg    string         `json:"msg"`
	Params map[string]any `json:"params"`
}

type OutStream

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

func (*OutStream) Read

func (c *OutStream) Read(b []byte) (n int, err error)

type StreamStruct

type StreamStruct struct {
	Device   string  `json:"device"`
	SubProto string  `json:"subproto"`
	Delta    float64 `json:"delta"`
}

func (*StreamStruct) JSONDecode

func (mr *StreamStruct) JSONDecode(jsonmap map[string]any) error

Convert the golang map of any to the StreamStruct

type StringListThreadSafe

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

func (*StringListThreadSafe) Clear

func (c *StringListThreadSafe) Clear()

func (*StringListThreadSafe) NotEmpty

func (c *StringListThreadSafe) NotEmpty() bool

func (*StringListThreadSafe) PopFromLog

func (c *StringListThreadSafe) PopFromLog() string

func (*StringListThreadSafe) PushBack

func (c *StringListThreadSafe) PushBack(str string)

type StringNotifyFunc

type StringNotifyFunc func(client *WCClient, value string)

type StringThreadSafe

type StringThreadSafe struct {
	Value string
	// contains filtered or unexported fields
}

func (*StringThreadSafe) Clear

func (c *StringThreadSafe) Clear()

func (*StringThreadSafe) GetValue

func (c *StringThreadSafe) GetValue() string

func (*StringThreadSafe) GetValueUnsafePtr

func (c *StringThreadSafe) GetValueUnsafePtr() *string

func (*StringThreadSafe) SetValue

func (c *StringThreadSafe) SetValue(str string) bool

type Task

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

func (*Task) GetClient

func (tsk *Task) GetClient() *WCClient

func (*Task) GetKind

func (tsk *Task) GetKind() TaskKind

func (*Task) GetLastError

func (tsk *Task) GetLastError() error

func (*Task) GetUserData

func (tsk *Task) GetUserData() any

type TaskKind

type TaskKind int
const (
	TaskDefault TaskKind = iota
	TaskInputStream
	TaskOutputStream
)

type TaskNotifyFunc

type TaskNotifyFunc func(tsk ITask)

type WCClient

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

func ClientNew

func ClientNew(cfg *WCClientConfig) (*WCClient, error)

Create client.

`cfg` is a complete configuration for the client.
`return` pointer to the new client instance and the error object.

func (*WCClient) AddLog

func (c *WCClient) AddLog(aStr string)

Add the new string to the message log

func (*WCClient) Auth

func (c *WCClient) Auth(aLogin, aPwrd string) error

Launch request to authorize the client on the server host.

See protocol request `authorize.json`. If the specified
`aLogin` or `aPwrd` are empty strings, the client tries to
connect to the host using the username section from the host
URL (\sa SetHostURL)

`aLogin` is the name of the user on the server.
`aPwrd` is the password of the user on the server.
`return` nil on success or the error object.

func (*WCClient) AuthFromHostUrl

func (c *WCClient) AuthFromHostUrl() error

Launch request to authorize the client on the server host.

See protocol request `authorize.json`. Username and password are parsed from the
host URL (\sa SetHostURL)

`return` nil on success or the error object.

func (*WCClient) ClearError

func (c *WCClient) ClearError()

Clear the client”s last error string

func (*WCClient) ClearLog

func (c *WCClient) ClearLog()

Clear the client”s log

func (*WCClient) DeleteRecords

func (c *WCClient) DeleteRecords(aIndices []int, callback ...any) error

Delete specified media records for authorized client (see also `deleteRecords.json`).

`aIndices` is the array filled with the IDs of the records to be deleted
The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnSuccessDeleteRecords method). The `callback` can be passed as:
1. a pair of values - a callback (TaskNotifyFunc) and user data (any)
2. just a reference to a callback of type TaskNotifyFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) Disconnect

func (c *WCClient) Disconnect() error

Disconnect client from the server host.

`return` nil on success or error object.

func (*WCClient) GetClientStatus

func (c *WCClient) GetClientStatus() ClientStatus

Get the current status for the client

func (*WCClient) GetConfig

func (c *WCClient) GetConfig(callback ...any) error

Get configuration from the server for authorized client (sa `getConfig.json` request).

The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnGetConfig method). The `callback` can be passed as:
1. a pair of values - a callback (JSONArrayNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONArrayNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) GetLog

func (c *WCClient) GetLog() *StringListThreadSafe

Get the client”s log

func (*WCClient) GetLstMsgStamp

func (c *WCClient) GetLstMsgStamp() string

The timestamp of the last received message

func (*WCClient) GetLstRecStamp

func (c *WCClient) GetLstRecStamp() string

The timestamp of the last received media record

func (*WCClient) GetSID

func (c *WCClient) GetSID() string

Get the current session id for the client

func (*WCClient) InvalidateState

func (c *WCClient) InvalidateState(aStateId ClientState, callback ...any) error

Reset the selected client state.

Acceptable values of the state param are:
STATE_LOG - clear the log,
STATE_ERROR - delete information about the last error,
STATE_DEVICES - update the list of devices (see also `getDevicesOnline.json`),
STATE_RECORDS - update the list of media records (see also `getRecordCount.json`
 - according to the results of the request, the STATE_RECORDSSTAMP state will be
  updated automatically),
STATE_RECORDSSTAMP - clear the timestamp for records (the *stamp* parameter in
	 `getRecordCount.json` request),
STATE_MSGS - update the list of messages (see also `getMsgs.json` - according to
 the results of the request, the STATE_MSGSSTAMP state will be updated
 automatically),
STATE_SENDWITHSYNC - uncheck the synchronization flag - the next update of the
 message list will occur without the sending of a 'sync' message
 (`getMsgsAndSync.json`),
STATE_MSGSSTAMP - clear the timestamp for messages (the *stamp* parameter in
 `getMsgs.json` request),
STATE_STREAMS - update the list of streams (see also `getStreams.json`),
STATE_CONFIG - get the current client config (see also `getConfig.json`),

Resetting STATE_DEVICES, STATE_RECORDS, STATE_MSGS, STATE_STREAMS, STATE_CONFIG
states will update the selected state from the client's thread.
During the execution of main loop, requests `getDevicesOnline.json`,
`getRecordCount.json`, `getMsgs.json`, `getStreams.json` and `getConfig.json`
will be generated and launched, respectively.

`aStateId` is the selected client state,
The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOn... methods). The `callback` can be passed as:
1. a pair of values - a callback (JSONArrayNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONArrayNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData

`return` nil on success or the error object.

func (*WCClient) IsClientStatusInRange

func (c *WCClient) IsClientStatusInRange(st []ClientStatus) bool

Check is the client status in the given range

func (*WCClient) LastError

func (c *WCClient) LastError() string

Get the last occurred error string description for the client

func (*WCClient) LaunchInStream

func (c *WCClient) LaunchInStream(aDeviceName string, onNewFrame TaskNotifyFunc, userdata ...any) error

Launch incoming stream for authorized client (sa `output.raw` request).

`aDeviceName` is the name of streaming device to listen,
`onNewFrame` is the callback to catch the `new frame` event,
`userdata` is the additional user data that passed to the new task (GetUserData)
`return` nil on success or the error object.

func (*WCClient) LaunchOutStream

func (c *WCClient) LaunchOutStream(aSubProto string, aDelta int, userdata ...any) error

Launch output stream for authorized client (sa `input.raw` request).

`subProtocol` is the sub protocol description,
`delta` is the delta time between frames in ms,
`userdata` is the additional user data that passed to the new task (GetUserData)
`return` nil on success or the error object.

func (*WCClient) PopInFrame

func (c *WCClient) PopInFrame() (*bytes.Buffer, error)

Get the new frame from the incoming stream (sa `output.raw` request).

`return` bytes.Buffer with the frame body on success or the
error object. If there is no frames in the stream sequece -
the function returns both nil for Buffer and error results

func (*WCClient) PushOutData

func (c *WCClient) PushOutData(data *bytes.Buffer) error

Push the new data frame to the output stream (sa `input.raw` request).

`data` is the byte buffer with the frame header and its body
`return` nil on success or the error object.

func (*WCClient) RequestRecord

func (c *WCClient) RequestRecord(rid int, userdata ...any) error

Get the blob data of the media record (see also `getRecordData.json`).

`rid` is the id of the media record
`userdata` is the additional user data that passed to the new task (GetUserData)
`return` nil on success or the error object.

func (*WCClient) RequestRecordMeta

func (c *WCClient) RequestRecordMeta(rid int, callback ...any) error

Get the metadata for the media record (see also `getRecordMeta.json`).

`rid` is the id of the media record
The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnReqRecordMeta method). The `callback` can be passed as:
1. a pair of values - a callback (JSONNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) SaveRecord

func (c *WCClient) SaveRecord(aBuf io.ReadCloser, aBufSize int64, meta string, callback ...any) error

Save the media record (see also `addRecord.json`).

`aBuf` is the user-specified Reader with the frame data
`aBufSize` is the frame size, mandatory if the Reader is not provided content length by itself
`meta` is additional metadata for the saving media record
The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnSuccessSaveRecord method). The `callback` can be passed as:
1. a pair of values - a callback (TaskNotifyFunc) and user data (any)
2. just a reference to a callback of type TaskNotifyFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) SendMsgs

func (c *WCClient) SendMsgs(aMsg any, callback ...any) error

Send a new message(s) to the server from device.

See protocol request `addMsgs.json`.

`aMsg` is the message object or array of messages.
Allowable type for `aMsg` is:
1. map[string]any
2. *OutMessageStruct - to send one outgoing message
3. []map[string]any
4. []*OutMessageStruct - to send several outgoing messages
The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnSuccessSendMsg method). The `callback` can be passed as:
1. a pair of values - a callback (TaskNotifyFunc) and user data (any)
2. just a reference to a callback of type TaskNotifyFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) SetConfig

func (c *WCClient) SetConfig(aStr []any, callback ...any) error

Send configuration of authorized client to the server (sa `setConfig.json` request).

`aStr` is the array of configuration elements. The possible types of each element
in this array are: map[string]any or *OutConfigElementStruct
The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnSetConfig method). The `callback` can be passed as:
1. a pair of values - a callback (TaskNotifyFunc) and user data (any)
2. just a reference to a callback of type TaskNotifyFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) SetLstMsgStamp

func (c *WCClient) SetLstMsgStamp(value string)

Set the timestamp of the last received message

func (*WCClient) SetLstMsgStampToSyncPoint

func (c *WCClient) SetLstMsgStampToSyncPoint()

Reset the timestamp of the last received message to the sync point

func (*WCClient) SetLstRecStamp

func (c *WCClient) SetLstRecStamp(value string)

Set the timestamp of the last received media record

func (*WCClient) SetNeedToSync

func (c *WCClient) SetNeedToSync(val bool)

Set is the next update of the message list will occur with or without the sending of a 'sync' message (sa. getMsgsAndSync - WCPD)

func (*WCClient) SetOnAddLog

func (c *WCClient) SetOnAddLog(event StringNotifyFunc)

Set new callback for the "Added new log entry" event.

`event` is the reference to the callback function

func (*WCClient) SetOnAfterLaunchInStream

func (c *WCClient) SetOnAfterLaunchInStream(event TaskNotifyFunc)

Set new callback for the "Incoming stream started" event.

`event` is the reference to the callback function

func (*WCClient) SetOnAfterLaunchOutStream

func (c *WCClient) SetOnAfterLaunchOutStream(event TaskNotifyFunc)

Set new callback for the "Outgoing stream started" event.

`event` is the reference to the callback function

func (*WCClient) SetOnAuthSuccess

func (c *WCClient) SetOnAuthSuccess(event TaskNotifyFunc)

Set new callback for the "Successful authorization" event.

`event` is the reference to the callback function

func (*WCClient) SetOnConnected

func (c *WCClient) SetOnConnected(event ConnNotifyEventFunc)

Set new callback for the "The connection state has been changed" event.

`event` is the reference to the callback function

func (*WCClient) SetOnDisconnect

func (c *WCClient) SetOnDisconnect(event NotifyEventFunc)

Set new callback for the "Client has been disconnected" event.

`event` is the reference to the callback function

func (*WCClient) SetOnGetConfig

func (c *WCClient) SetOnGetConfig(event JSONArrayNotifyEventFunc)

Set new callback for the "The request to get actual config has been completed. The response has arrived" event.

`event` is the reference to the callback function
`jsonresult` inside JSONArrayNotifyEventFunc will contain reference to the array of
the incoming config elements

func (*WCClient) SetOnReqRecordData

func (c *WCClient) SetOnReqRecordData(event DataNotifyEventFunc)

Set new callback for the "The request to get the media record has been completed. The response has arrived" event.

`event` is the reference to the callback function
`data` inside DataNotifyEventFunc will contain reference to the
byte buffer

func (*WCClient) SetOnReqRecordMeta

func (c *WCClient) SetOnReqRecordMeta(event JSONNotifyEventFunc)

Set new callback for the "The request to get metadata for the media record has been completed. The response has arrived" event.

`event` is the reference to the callback function
`jsonresult` inside JSONNotifyEventFunc will contain reference to the meta data for
the media record

func (*WCClient) SetOnSetConfig

func (c *WCClient) SetOnSetConfig(event TaskNotifyFunc)

Set new callback for the "The request to set a new config has been completed. The response has arrived" event.

`event` is the reference to the callback function

func (*WCClient) SetOnSuccessDeleteRecords

func (c *WCClient) SetOnSuccessDeleteRecords(event TaskNotifyFunc)

Set new callback for the "The request to delete records has been completed. The response has arrived" event.

`event` is the reference to the callback function

func (*WCClient) SetOnSuccessIOStream

func (c *WCClient) SetOnSuccessIOStream(event TaskNotifyFunc)

Set new callback for the "IO stream terminated for some reason" event.

`event` is the reference to the callback function

func (*WCClient) SetOnSuccessSaveRecord

func (c *WCClient) SetOnSuccessSaveRecord(event TaskNotifyFunc)

Set new callback for the "The request to save the media record has been completed. The response has arrived" event.

`event` is the reference to the callback function

func (*WCClient) SetOnSuccessSendMsg

func (c *WCClient) SetOnSuccessSendMsg(event TaskNotifyFunc)

Set new callback for the "The request to get metadata for the media record has been completed. The response has arrived" event.

`event` is the reference to the callback function

func (*WCClient) SetOnUpdateDevices

func (c *WCClient) SetOnUpdateDevices(event JSONArrayNotifyEventFunc)

Set new callback for the "The request to update list of online devices has been completed. The response has arrived" event.

`event` is the reference to the callback function
`jsonresult` inside JSONArrayNotifyEventFunc will contain reference to the array of
the online devices

func (*WCClient) SetOnUpdateMsgs

func (c *WCClient) SetOnUpdateMsgs(event JSONArrayNotifyEventFunc)

Set new callback for the "The request to update list of messages has been completed. The response has arrived" event.

`event` is the reference to the callback function
`jsonresult` inside JSONArrayNotifyEventFunc will contain reference to the array of
the incoming messages

func (*WCClient) SetOnUpdateRecords

func (c *WCClient) SetOnUpdateRecords(event JSONArrayNotifyEventFunc)

Set new callback for the "The request to update list of media records has been completed. The response has arrived" event.

`event` is the reference to the callback function
`jsonresult` inside JSONArrayNotifyEventFunc will contain reference to the array of
the media records (with no data. to get the data of media record by its id use
the GetRecordData/GetRecordMeta methods)

func (*WCClient) SetOnUpdateStreams

func (c *WCClient) SetOnUpdateStreams(event JSONArrayNotifyEventFunc)

Set new callback for the "The request to update list of streaming devices has been completed The response has arrived" event.

`event` is the reference to the callback function
`jsonresult` inside JSONArrayNotifyEventFunc will contain reference to the array of
the streaming devices

func (*WCClient) SetSIDSetted

func (c *WCClient) SetSIDSetted(event StringNotifyFunc)

Set new callback for the "The session id has been changed" event.

`event` is the reference to the callback function

func (*WCClient) Start

func (c *WCClient) Start() error

Launch client.

The function initializes and starts the client''s working thread.
After calling this method the assigned client configuration will be locked

`return` nil on success or error object.

func (*WCClient) StopStreaming

func (c *WCClient) StopStreaming()

Stop streaming for the client

func (*WCClient) UpdateDevices

func (c *WCClient) UpdateDevices(callback ...any) error

Update the list of devices (see also `getDevicesOnline.json`).

The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnUpdateDevices method). The `callback` can be passed as:
1. a pair of values - a callback (JSONArrayNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONArrayNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) UpdateMsgs

func (c *WCClient) UpdateMsgs(callback ...any) error

Get new messages from the server.

See protocol requests ` getMsgs.json`, `getMsgsAndSync.json`.
According to the results of the request, the STATE_MSGSSTAMP state will be updated
automatically.

The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnUpdateMsgs method). The `callback` can be passed as:
1. a pair of values - a callback (JSONArrayNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONArrayNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) UpdateRecords

func (c *WCClient) UpdateRecords(callback ...any) error

Update the list of media records (see also `getRecordCount.json`).

According to the results of the request, the STATE_RECORDSSTAMP state will be
updated automatically.

The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnUpdateRecords method). The `callback` can be passed as:
1. a pair of values - a callback (JSONArrayNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONArrayNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) UpdateStreams

func (c *WCClient) UpdateStreams(callback ...any) error

Update the list of streams (see also `getStreams.json`).

The `callback` is the callback data that is used upon successful completion.
if a null or empty value is set, the client calls a predefined corresponding function
(\sa WCClient.SetOnUpdateStreams method). The `callback` can be passed as:
1. a pair of values - a callback (JSONArrayNotifyEventFunc) and user data (any)
2. just a reference to a callback of type JSONArrayNotifyEventFunc
3. user data (any) - \sa ITask.GetUserData
`return` nil on success or the error object.

func (*WCClient) Working

func (c *WCClient) Working() bool

Is the client's working thread running

type WCClientConfig

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

func ClientCfgNew

func ClientCfgNew() *WCClientConfig

Create new empty client configuration

func (*WCClientConfig) AssignFrom

func (c *WCClientConfig) AssignFrom(src *WCClientConfig) error

Clone config from other instance

func (*WCClientConfig) GetDevice

func (c *WCClientConfig) GetDevice() string

Get the assigned device name

func (*WCClientConfig) GetHost

func (c *WCClientConfig) GetHost() string

Get the assigned server host address

func (*WCClientConfig) GetMeta

func (c *WCClientConfig) GetMeta() string

Get the assigned meta data for the device (sa. "authorize.json" - WCPD)

func (*WCClientConfig) GetPort

func (c *WCClientConfig) GetPort() int

Get the assigned server host port

func (*WCClientConfig) GetUrl

func (c *WCClientConfig) GetUrl(command string) string

Get the complete url for the JSON-request

func (*WCClientConfig) GetVerifyTLS

func (c *WCClientConfig) GetVerifyTLS() bool

Get the value of the flag - should client verify TLS certificate

func (*WCClientConfig) SetDevice

func (c *WCClientConfig) SetDevice(device string) error

Set the device name

func (*WCClientConfig) SetHostURL

func (c *WCClientConfig) SetHostURL(hosturl string) error

Set the server host address `https://[username[:password]@]hostname[:port]`

func (*WCClientConfig) SetMeta

func (c *WCClientConfig) SetMeta(val string) error

Set new meta data for the device (sa. "authorize.json" - WCPD)

func (*WCClientConfig) SetPort

func (c *WCClientConfig) SetPort(port int) error

Set the server host port

func (*WCClientConfig) SetProxy

func (c *WCClientConfig) SetProxy(proxy string) error

Set the server proxy params in format `[scheme:]//[user[:password]@]host[:port]`

func (*WCClientConfig) SetVerifyTLS

func (c *WCClientConfig) SetVerifyTLS(sec bool) error

Set or unset the flag - should client verify TLS certificate

Jump to

Keyboard shortcuts

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