@@ -25,14 +25,14 @@ import (
2525 "github.com/connet-dev/connet/model"
2626 "github.com/connet-dev/connet/netc"
2727 relaysrv "github.com/connet-dev/connet/relay"
28+ "github.com/connet-dev/connet/reliable"
2829 "github.com/connet-dev/connet/restr"
2930 "github.com/connet-dev/connet/selfhosted"
3031 "github.com/connet-dev/connet/server"
3132 "github.com/connet-dev/connet/statusc"
3233 "github.com/gorilla/websocket"
3334 "github.com/pires/go-proxyproto"
3435 "github.com/stretchr/testify/require"
35- "golang.org/x/sync/errgroup"
3636)
3737
3838type connectedTestCase struct {
@@ -212,10 +212,10 @@ func TestE2E(t *testing.T) {
212212 )
213213 require .NoError (t , err )
214214
215- g , ctx := errgroup . WithContext (ctx )
216- g .Go (func () error { return proxyProtoServer ( ctx , ppListen ) } )
217- g .Go (func () error { return echoServer ( ctx , echoListen ) } )
218- g .Go (func () error { return srv .Run ( ctx ) } )
215+ g := reliable . NewGroup (ctx )
216+ g .Go (reliable . Bind ( ppListen , proxyProtoServer ) )
217+ g .Go (reliable . Bind ( echoListen , echoServer ) )
218+ g .Go (srv .Run )
219219
220220 time .Sleep (time .Millisecond ) // time for server to come online
221221
@@ -427,17 +427,17 @@ func TestE2E(t *testing.T) {
427427 switch {
428428 case tc .isSuccessProxyProto ():
429429 dstSrv := NewTCPDestination (dst , ppAddr , 0 , logger )
430- g .Go (func () error { return dstSrv .Run ( ctx ) } )
430+ g .Go (dstSrv .Run )
431431 case tc .isSuccessTLS ():
432432 clientTransport := htsServer .Client ().Transport .(* http.Transport )
433433 dstSrv := NewTLSDestination (dst , htsAddr , clientTransport .TLSClientConfig , 0 , logger )
434- g .Go (func () error { return dstSrv .Run ( ctx ) } )
434+ g .Go (dstSrv .Run )
435435 case tc .isSuccessWS ():
436436 dstSrv := NewTCPDestination (dst , echoAddr , 0 , logger )
437- g .Go (func () error { return dstSrv .Run ( ctx ) } )
437+ g .Go (dstSrv .Run )
438438 default :
439439 dstSrv := NewTCPDestination (dst , htAddr , 0 , logger )
440- g .Go (func () error { return dstSrv .Run ( ctx ) } )
440+ g .Go (dstSrv .Run )
441441 }
442442
443443 src , err := clSrc .Source (ctx , tc .s )
@@ -446,20 +446,20 @@ func TestE2E(t *testing.T) {
446446 switch {
447447 case tc .isSuccessTLS ():
448448 srcSrv := NewTLSSource (src , fmt .Sprintf (":%d" , tc .sport ), htsServer .TLS , logger )
449- g .Go (func () error { return srcSrv .Run ( ctx ) } )
449+ g .Go (srcSrv .Run )
450450 case tc .isSuccessWS ():
451451 srcURL , err := url .Parse (fmt .Sprintf ("ws://:%d" , tc .sport ))
452452 require .NoError (t , err )
453453 srcSrv := NewWSSource (src , srcURL , nil , logger )
454- g .Go (func () error { return srcSrv .Run ( ctx ) } )
454+ g .Go (srcSrv .Run )
455455 case tc .isFail ():
456456 srcURL , err := url .Parse (fmt .Sprintf ("http://:%d" , tc .sport ))
457457 require .NoError (t , err )
458458 srcSrv := NewHTTPSource (src , srcURL , nil )
459- g .Go (func () error { return srcSrv .Run ( ctx ) } )
459+ g .Go (srcSrv .Run )
460460 default :
461461 srcSrv := NewTCPSource (src , fmt .Sprintf (":%d" , tc .sport ), logger )
462- g .Go (func () error { return srcSrv .Run ( ctx ) } )
462+ g .Go (srcSrv .Run )
463463 }
464464 }
465465
0 commit comments