1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-22 17:27:12 -05:00
v2fly/transport/internet/kcp/config.go
2016-06-20 16:10:47 +02:00

36 lines
708 B
Go

package kcp
type Config struct {
Mtu int // Maximum transmission unit
Tti int
UplinkCapacity int
DownlinkCapacity int
Congestion bool
}
func (this *Config) Apply() {
effectiveConfig = *this
}
func (this *Config) GetSendingWindowSize() int {
return this.UplinkCapacity * 1024 * 1024 / this.Mtu / (1000 / this.Tti)
}
func (this *Config) GetReceivingWindowSize() int {
return this.DownlinkCapacity * 1024 * 1024 / this.Mtu / (1000 / this.Tti)
}
func DefaultConfig() Config {
return Config{
Mtu: 1350,
Tti: 20,
UplinkCapacity: 5,
DownlinkCapacity: 20,
Congestion: false,
}
}
var (
effectiveConfig = DefaultConfig()
)