tc

package
v0.0.0-...-55bacb3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CRC16("github.com/privatix/dapp-openvpn/adapter/tc") = 0x63FE
	ErrBadClientIP errors.Error = 0x63FE<<8 + iota
)

Errors.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TcPath       string
	IptablesPath string
}

Config is a traffic control configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a default configuration.

type TrafficControl

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

TrafficControl is a traffic control utility.

func NewTrafficControl

func NewTrafficControl(conf *Config, logger log.Logger) *TrafficControl

NewTrafficControl creates a new TrafficControl instance.

func (*TrafficControl) SetRateLimit

func (tc *TrafficControl) SetRateLimit(
	iface, clientIP string, upMbps, downMbps float32) error

SetRateLimit sets a rate limit for a given client IP address on a given network interface.

func (*TrafficControl) UnsetRateLimit

func (tc *TrafficControl) UnsetRateLimit(iface, clientIP string) error

UnsetRateLimit removes a rate limit for a given client IP address on a given network interface.

Jump to

Keyboard shortcuts

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