Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.travis.yml | H A D | 07-Aug-2017 | 38 | |||
README.md | H A D | 07-Aug-2017 | 1.5 KiB | |||
linkio.go | H A D | 07-Aug-2017 | 4.8 KiB | |||
linkio_test.go | H A D | 07-Aug-2017 | 1.1 KiB |
README.md
1linkio [![GoDoc](https://godoc.org/github.com/ian-kent/linkio?status.svg)](https://godoc.org/github.com/ian-kent/linkio) [![Build Status](https://travis-ci.org/ian-kent/linkio.svg?branch=master)](https://travis-ci.org/ian-kent/linkio) 2====== 3 4linkio provides an io.Reader and io.Writer that simulate a network connection of a certain speed, e.g. to simulate a mobile connection. 5 6### Quick start 7 8You can use `linkio` to wrap existing io.Reader and io.Writer interfaces: 9 10```go 11// Create a new link at 512kbps 12link = linkio.NewLink(512 * linkio.KilobitPerSecond) 13 14// Open a connection 15conn, err := net.Dial("tcp", "google.com:80") 16if err != nil { 17 // handle error 18} 19 20// Create a link reader/writer 21linkReader := link.NewLinkReader(io.Reader(conn)) 22linkWriter := link.NewLinkWriter(io.Writer(conn)) 23 24// Use them as you would normally... 25fmt.Fprintf(linkWriter, "GET / HTTP/1.0\r\n\r\n") 26status, err := bufio.NewReader(linkReader).ReadString('\n') 27 28``` 29 30### History and license 31 32This repository is a fork of [Jeff R. Allen's 33linkio](https://github.com/jeffallen/jra-go/tree/master/linkio). linkio 34was brought into the world to help make a proxy to simulate slow 35Internet links (see [this blog 36posting](https://blog.nella.org/a-rate-limiting-http-proxy-in-go/)). 37 38Jeff's linkio was licensed via the [BSD 3-clause 39license](http://opensource.org/licenses/BSD-3-Clause). 40 41Any modifications since the initial commit are Copyright © 2014, Ian 42Kent (http://iankent.uk), and are released under the terms of the [MIT 43License](http://opensource.org/licenses/MIT). 44