mock_tcp_server

command module
v0.0.0-...-7f5504d Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

README

MOCK TCP SERVER

A tcp server mock, if receive some matched bytes, it will response the specific file data.

Config it

server.conf

{
    "host": "127.0.0.1",
    "port": 8080,
    "dump_request": true,
    "matchs": [{
        "type": "string",
        "match_data": "efg",
        "response_file": "test_1.txt"
    }, {
        "type": "byte",
        "match_data": "616263",
        "response_file": "test_2.txt"
    }]
}
  • type string byte
  • match_data string: just input match string byte:ascii
  • dump_request if configured the dump_request = true, will dump the request data to file ./dump/{timestamp}/{ID}.dat
Start it
$ go run main.go
Test it

Open browser, and test http://127.0.0.1:8080/abc and http://127.0.0.1:8080/efg, you will get different data.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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