mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-16 17:38:45 -05:00
KCP:func ListenKCP finished
This commit is contained in:
parent
a9ef8d27bd
commit
70201d8879
@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"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/hub/kcpv"
|
||||
"github.com/xtaci/kcp-go"
|
||||
@ -126,3 +127,12 @@ func DialKCP(dest v2net.Destination) (*KCPVconn, error) {
|
||||
}
|
||||
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