| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package core_test
- import (
- "testing"
- . "v2ray.com/core"
- "v2ray.com/core/app/proxyman"
- "v2ray.com/core/common/dice"
- "v2ray.com/core/common/net"
- "v2ray.com/core/common/protocol"
- "v2ray.com/core/common/serial"
- "v2ray.com/core/common/uuid"
- _ "v2ray.com/core/main/distro/all"
- "v2ray.com/core/proxy/dokodemo"
- "v2ray.com/core/proxy/vmess"
- "v2ray.com/core/proxy/vmess/outbound"
- . "v2ray.com/ext/assert"
- )
- func TestV2RayClose(t *testing.T) {
- assert := With(t)
- port := net.Port(dice.RollUint16())
- userId := uuid.New()
- config := &Config{
- App: []*serial.TypedMessage{
- serial.ToTypedMessage(&proxyman.InboundConfig{}),
- serial.ToTypedMessage(&proxyman.OutboundConfig{}),
- },
- Inbound: []*InboundHandlerConfig{
- {
- ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
- PortRange: net.SinglePortRange(port),
- Listen: net.NewIPOrDomain(net.LocalHostIP),
- }),
- ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
- Address: net.NewIPOrDomain(net.LocalHostIP),
- Port: uint32(0),
- NetworkList: &net.NetworkList{
- Network: []net.Network{net.Network_TCP, net.Network_UDP},
- },
- }),
- },
- },
- Outbound: []*OutboundHandlerConfig{
- {
- ProxySettings: serial.ToTypedMessage(&outbound.Config{
- Receiver: []*protocol.ServerEndpoint{
- {
- Address: net.NewIPOrDomain(net.LocalHostIP),
- Port: uint32(0),
- User: []*protocol.User{
- {
- Account: serial.ToTypedMessage(&vmess.Account{
- Id: userId.String(),
- }),
- },
- },
- },
- },
- }),
- },
- },
- }
- server, err := New(config)
- assert(err, IsNil)
- server.Close()
- }
|