Giter Club home page Giter Club logo

linkio's Introduction

linkio GoDoc Build Status

linkio provides an io.Reader and io.Writer that simulate a network connection of a certain speed, e.g. to simulate a mobile connection.

Quick start

You can use linkio to wrap existing io.Reader and io.Writer interfaces:

// Create a new link at 512kbps
link = linkio.NewLink(512 * linkio.KilobitPerSecond)

// Open a connection
conn, err := net.Dial("tcp", "google.com:80")
if err != nil {
  // handle error
}

// Create a link reader/writer
linkReader := link.NewLinkReader(io.Reader(conn))
linkWriter := link.NewLinkWriter(io.Writer(conn))

// Use them as you would normally...
fmt.Fprintf(linkWriter, "GET / HTTP/1.0\r\n\r\n")
status, err := bufio.NewReader(linkReader).ReadString('\n')

LICENSE

This code is originally a fork of code.google.com/p/jra-go/linkio.

The source contained this license text:

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.

There is no LICENSE file, but it may be referring to this.

Any modifications since the initial commit are Copyright ยฉโ€Ž 2014, Ian Kent (http://iankent.uk), and are released under the terms of the MIT License.

linkio's People

Contributors

ian-kent avatar

Watchers

guangming avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.