| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | package kcpimport (	v2net "v2ray.com/core/common/net"	"v2ray.com/core/transport/internet")func (this *MTU) GetValue() uint32 {	if this == nil {		return 1350	}	return this.Value}func (this *TTI) GetValue() uint32 {	if this == nil {		return 50	}	return this.Value}func (this *UplinkCapacity) GetValue() uint32 {	if this == nil {		return 5	}	return this.Value}func (this *DownlinkCapacity) GetValue() uint32 {	if this == nil {		return 20	}	return this.Value}func (this *WriteBuffer) GetSize() uint32 {	if this == nil {		return 1 * 1024 * 1024	}	return this.Size}func (this *ReadBuffer) GetSize() uint32 {	if this == nil {		return 1 * 1024 * 1024	}	return this.Size}func (this *Config) GetAuthenticator() (internet.Authenticator, error) {	auth := NewSimpleAuthenticator()	if this.HeaderConfig != nil {		rawConfig, err := this.HeaderConfig.GetInstance()		if err != nil {			return nil, err		}		header, err := internet.CreateAuthenticator(this.HeaderConfig.Type, rawConfig)		if err != nil {			return nil, err		}		auth = internet.NewAuthenticatorChain(header, auth)	}	return auth, nil}func (this *Config) GetSendingInFlightSize() uint32 {	size := this.UplinkCapacity.GetValue() * 1024 * 1024 / this.Mtu.GetValue() / (1000 / this.Tti.GetValue()) / 2	if size < 8 {		size = 8	}	return size}func (this *Config) GetSendingBufferSize() uint32 {	return this.WriteBuffer.GetSize() / this.Mtu.GetValue()}func (this *Config) GetReceivingInFlightSize() uint32 {	size := this.DownlinkCapacity.GetValue() * 1024 * 1024 / this.Mtu.GetValue() / (1000 / this.Tti.GetValue()) / 2	if size < 8 {		size = 8	}	return size}func (this *Config) GetReceivingBufferSize() uint32 {	return this.ReadBuffer.GetSize() / this.Mtu.GetValue()}func (o *ConnectionReuse) IsEnabled() bool {	if o == nil {		return true	}	return o.Enable}func init() {	internet.RegisterNetworkConfigCreator(v2net.Network_KCP, func() interface{} {		return new(Config)	})}
 |