Socket
Socket
Sign inDemoInstall

github.com/gogap/mock_tcp_server

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/gogap/mock_tcp_server


Version published

Readme

Source

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.

FAQs

Last updated on 04 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc