mtu

package module
v0.0.0-...-d0301d8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 8 Imported by: 0

README

MTU

用于发现链路的MTU,通过发送不同大小的DF标识的IP包探测链路MTU、采用二分法。探测上行链路采用系统自带的PING命令,以免需要管理员权限;探测下行链路需要服务器支持。

快速开始

参考

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MTU

type MTU struct {
	PingHost  string // 探测上行MTU时设置, PING命令请求地址, 默认baidu.com
	SeverAddr string // 下行MTU时设置, 服务器IP或域名

	// Port 使用端口(UDP), 探测下行链路时设置, 默认 19986
	Port int
}

func NewMTU

func NewMTU(f func(m *MTU) *MTU) *MTU

NewMTU

func (*MTU) Client

func (m *MTU) Client(isUpLink bool, fastMode bool) (uint16, error)

Client 客户端

isUpLink 探测上行路径MTU,否则探测下行MTU
fastMode 探测上行链路的快速模式,更快
 如数据包太大时,Ubuntu会提示:ping: local error: message too long, mtu=1400,快速模式直接采用1400这个值

func (*MTU) Sever

func (m *MTU) Sever() error

Sever 服务, 探测下行链路需要

需要发送自定义IP包, 需要root权限运行。
确保服务器的上行MTU足够大, 不应成为链路瓶颈

Directories

Path Synopsis
internal
com
test

Jump to

Keyboard shortcuts

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