tracp

package module
v0.0.0-...-42bab5a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2016 License: MIT Imports: 10 Imported by: 0

README

Tracp

TRAffic Control in Port level
platform: OSX/Linux

Tracp will handle all packets which gothrough it and redirect them back to loopback.

Usage:

usage: tracpd [option]

options:
    -droprate <number>  0-100
    -bandwidth <number> max bandwidth per second, unit: byte
    -mindelay           min delay time
    -maxdelay           max delay time
    -h                  show help

example

# go install github.com/chzyer/tracp/cmd/tracpd
$ sudo tracpd -mindelay 200ms
$ ping 10.1 # use 10.0.0.1 instead of 127.0.0.1
PING 10.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: icmp_seq=0 ttl=64 time=420.205 ms
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=417.257 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=413.291 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=400.472 ms

Documentation

Overview

Traffic Control in Port level

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DropRate  int           `desc:"0-100"`
	BandWidth int           `desc:"max bandwidth per second, unit: byte"`
	MinDelay  time.Duration `desc:"min delay time"`
	MaxDelay  time.Duration `desc:"max delay time"`
}

func NewConfig

func NewConfig() *Config

func (*Config) FlaglyVerify

func (c *Config) FlaglyVerify() error

type Queue

type Queue []*QueueItem

func (*Queue) GetLastest

func (q *Queue) GetLastest() (gopacket.Packet, time.Time)

func (Queue) Len

func (q Queue) Len() int

func (Queue) Less

func (q Queue) Less(i, j int) bool

func (*Queue) Pop

func (q *Queue) Pop() interface{}

func (*Queue) Push

func (q *Queue) Push(obj interface{})

func (*Queue) SendInTime

func (q *Queue) SendInTime(p gopacket.Packet, send time.Time)

func (Queue) Swap

func (q Queue) Swap(i, j int)

type QueueItem

type QueueItem struct {
	// contains filtered or unexported fields
}

type RateLimit

type RateLimit struct {
	Rate      int
	BandWidth int64
	// contains filtered or unexported fields
}

func (*RateLimit) Drop

func (r *RateLimit) Drop(n int) bool

func (*RateLimit) Process

func (r *RateLimit) Process() int64

func (*RateLimit) RandomDrop

func (r *RateLimit) RandomDrop() bool

type Tracp

type Tracp struct {
	// contains filtered or unexported fields
}

func NewTracp

func NewTracp(f *flow.Flow, cfg *Config) *Tracp

func (*Tracp) Close

func (t *Tracp) Close()

func (*Tracp) Run

func (p *Tracp) Run()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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