Refactor bufio

This commit is contained in:
世界
2022-08-11 23:59:22 +08:00
parent c9226aeaaf
commit 97870c9288
14 changed files with 46 additions and 45 deletions

View File

@@ -23,14 +23,13 @@ func startInstance(t *testing.T, options option.Options) {
require.NoError(t, err)
err = instance.Start()
if err != nil {
time.Sleep(5 * time.Millisecond)
time.Sleep(time.Second)
continue
}
break
}
require.NoError(t, err)
t.Cleanup(func() {
time.Sleep(500 * time.Millisecond)
instance.Close()
})
}

View File

@@ -10,8 +10,8 @@ require (
github.com/docker/docker v20.10.17+incompatible
github.com/docker/go-connections v0.4.0
github.com/gofrs/uuid v4.2.0+incompatible
github.com/sagernet/sing v0.0.0-20220808004927-21369d10810d
github.com/sagernet/sing-shadowsocks v0.0.0-20220801112336-a91eacdd01e1
github.com/sagernet/sing v0.0.0-20220811152014-735372ab3ccf
github.com/sagernet/sing-shadowsocks v0.0.0-20220811135826-7e47fd1a99d9
github.com/spyzhov/ajson v0.7.1
github.com/stretchr/testify v1.8.0
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced
@@ -56,7 +56,7 @@ require (
github.com/sagernet/netlink v0.0.0-20220803045538-bdac49abf805 // indirect
github.com/sagernet/sing-dns v0.0.0-20220803121532-9e1ffb850d91 // indirect
github.com/sagernet/sing-tun v0.0.0-20220808133432-d378b6ca536d // indirect
github.com/sagernet/sing-vmess v0.0.0-20220804023624-e829b41c84c2 // indirect
github.com/sagernet/sing-vmess v0.0.0-20220811154439-e85c9d12159e // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
github.com/xtaci/smux v1.5.16 // indirect

View File

@@ -176,16 +176,16 @@ github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sagernet/netlink v0.0.0-20220803045538-bdac49abf805 h1:hE+vtsjBCCPmxkRz9jZA+CicHgVkDT6H+Av5ZzskVxs=
github.com/sagernet/netlink v0.0.0-20220803045538-bdac49abf805/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM=
github.com/sagernet/sing v0.0.0-20220808004927-21369d10810d h1:vWzXLfdGyAYYbBpYFFHErtJlBXC59AieYMlUMAI6gw8=
github.com/sagernet/sing v0.0.0-20220808004927-21369d10810d/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing v0.0.0-20220811152014-735372ab3ccf h1:k8ZXdBb5D6JqDTgwLAw4cazapPcLYbcJNxSFUvUff+s=
github.com/sagernet/sing v0.0.0-20220811152014-735372ab3ccf/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing-dns v0.0.0-20220803121532-9e1ffb850d91 h1:jxt2PYixIkK2i7nUGW3f+PzJagEZcbNyQddBWGuqNnw=
github.com/sagernet/sing-dns v0.0.0-20220803121532-9e1ffb850d91/go.mod h1:T77zZdE2Cm6VqnFumrpwsq+kxYsbq+vWDhmjtdSl/oM=
github.com/sagernet/sing-shadowsocks v0.0.0-20220801112336-a91eacdd01e1 h1:RYvOc69eSNMN0dwVugrDts41Nn7Ar/C/n/fvytvFcp4=
github.com/sagernet/sing-shadowsocks v0.0.0-20220801112336-a91eacdd01e1/go.mod h1:NqZjiXszgVCMQ4gVDa2V+drhS8NMfGqUqDF86EacEFc=
github.com/sagernet/sing-shadowsocks v0.0.0-20220811135826-7e47fd1a99d9 h1:/FFNyglfOlk1x6NWhBWI+bc/kVQc7SFOSYAJ2m7FwHc=
github.com/sagernet/sing-shadowsocks v0.0.0-20220811135826-7e47fd1a99d9/go.mod h1:3Pe1OCs1zrMyZmMB4st8GF/IL6EMHLSVnUHSS5VjnfM=
github.com/sagernet/sing-tun v0.0.0-20220808133432-d378b6ca536d h1:AQpkoUiF8FxYVI1lf2W9Rbkk914eHjVH9M8y+F/0+Nw=
github.com/sagernet/sing-tun v0.0.0-20220808133432-d378b6ca536d/go.mod h1:gWwYd53AqXl+Y+q6WlXUc6PkqU28sfu5VTQhyeEIFbw=
github.com/sagernet/sing-vmess v0.0.0-20220804023624-e829b41c84c2 h1:C8sc2MYiNx0O7uQ0nieJWq5qYeIHj20XHFWPlcgoQeY=
github.com/sagernet/sing-vmess v0.0.0-20220804023624-e829b41c84c2/go.mod h1:bNXBqSWYaG3ePl6u0xQY5zneE+ZKa3683ZpuE8S1M1w=
github.com/sagernet/sing-vmess v0.0.0-20220811154439-e85c9d12159e h1:iRCJqAbppWRlBQvHi/hPIN+QNWHPCU6yxf+P2de2gxA=
github.com/sagernet/sing-vmess v0.0.0-20220811154439-e85c9d12159e/go.mod h1:82O6gzbxLha/W/jxSVQbsqf2lVdRTjMIgyLug0lpJps=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=

View File

@@ -102,7 +102,7 @@ func testVMessMux(t *testing.T, protocol string) {
user, _ := uuid.NewV4()
startInstance(t, option.Options{
Log: &option.LogOptions{
Level: "trace",
Level: "error",
},
Inbounds: []option.Inbound{
{

View File

@@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestVMess(t *testing.T) {
func _TestVMessAuto(t *testing.T) {
security := "auto"
user, err := uuid.DefaultGenerator.NewV4()
require.NoError(t, err)
@@ -28,7 +28,7 @@ func TestVMess(t *testing.T) {
})
}
func _TestVMess(t *testing.T) {
func TestVMess(t *testing.T) {
for _, security := range []string{
"zero",
} {