mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-18 07:17:32 -05:00
KCP:func ListenKCP finished
This commit is contained in:
parent
a9ef8d27bd
commit
70201d8879
@ -6,6 +6,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/v2ray/v2ray-core/common/log"
|
"github.com/v2ray/v2ray-core/common/log"
|
||||||
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||||
"github.com/v2ray/v2ray-core/transport"
|
"github.com/v2ray/v2ray-core/transport"
|
||||||
"github.com/v2ray/v2ray-core/transport/hub/kcpv"
|
"github.com/v2ray/v2ray-core/transport/hub/kcpv"
|
||||||
"github.com/xtaci/kcp-go"
|
"github.com/xtaci/kcp-go"
|
||||||
@ -126,3 +127,12 @@ func DialKCP(dest v2net.Destination) (*KCPVconn, error) {
|
|||||||
}
|
}
|
||||||
return kcvn, nil
|
return kcvn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ListenKCP(address v2net.Address, port v2net.Port) (*KCPVlistener, error) {
|
||||||
|
kcpconf := transport.KcpConfig
|
||||||
|
cpip, _ := kcpv.GetChipher(kcpconf.Key)
|
||||||
|
laddr := address.String() + ":" + port.String()
|
||||||
|
kcl, err := kcp.ListenWithOptions(kcpconf.AdvancedConfigs.Fec, laddr, cpip)
|
||||||
|
kcvl := &KCPVlistener{lst: kcl, conf: kcpconf}
|
||||||
|
return kcvl, err
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user