MIMIC Go API Guide

  1. Table of Contents
  2. Requirements
  3. The MIMIC Go API is an optional Update Wizard package, and requires the use of a recent version of the Go language.

    MIMIC has been tested with Go version 1.5.4 on Linux and version 1.13.5 on Windows.

    1. Make sure you have Go installed, eg.

      $go version
      go version go1.5.4 linux/amd64
      

    2. Set your GOPATH environment variable to the golang subdirectory under your MIMIC install area, eg. if MIMIC is installed under the default /usr/local/mimic, in a bash:

      $export GOPATH=/usr/local/mimic/golang
      

      or on Windows

      $export GOPATH=c:/apps/mimic1920B5/golang
      

    3. Install required packages:

      $go get github.com/pborman/getopt/v2
      

  4. Class Reference
  5. The Go API is modelled after the Java API. All classes and methods have the same name as in Java, except that Go programming constructs are used. Click here for the generated Java reference documentation.

  6. Examples
    • The testapp.go program is an small test program to exercise the MIMIC API. Run it as follows:

      $go run testapp.go
      2019/12/06 15:46:49 TestApp: starting...
      2019/12/06 15:46:49 client dump
      2019/12/06 15:46:49 number of sessions 1
      2019/12/06 15:46:49 session dump
      2019/12/06 15:46:49 host 127.0.0.1
      2019/12/06 15:46:49 port 9797
      2019/12/06 15:46:49 sock 0xc000010010
      2019/12/06 15:46:49 INFO: correctly prevented session.Connect from leaking connections
      2019/12/06 15:46:49 TestApp: config file = agent.cfg
      2019/12/06 15:46:49 TestApp: max agents = 20000
      2019/12/06 15:46:49 TestApp: last agent = 13900
      2019/12/06 15:46:49 TestApp: version = 19.20
      2019/12/06 15:46:49 TestApp: num clients = 1
      ...