Skip to content

Commit 559beb1

Browse files
committed
Revert "fix: returning error if outbound by any reason is different then expected"
This reverts commit 93c63d5.
1 parent 93c63d5 commit 559beb1

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

protocol/group/selector.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package group
22

33
import (
44
"context"
5-
"fmt"
65
"net"
76

87
"github.com/sagernet/sing-box/adapter"
@@ -33,14 +32,8 @@ func NewSelector(ctx context.Context, router adapter.Router, logger log.ContextL
3332
if err != nil {
3433
return nil, err
3534
}
36-
switch o := outbound.(type) {
37-
case *group.Selector:
38-
return &Selector{o}, nil
39-
case *Selector:
40-
return o, nil
41-
default:
42-
return nil, fmt.Errorf("unexpected outbound type: %T", outbound)
43-
}
35+
36+
return &Selector{outbound.(*group.Selector)}, nil
4437
}
4538

4639
func (s *Selector) DialContext(ctx context.Context, network string, destination metadata.Socksaddr) (net.Conn, error) {

protocol/group/urltest.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package group
22

33
import (
44
"context"
5-
"fmt"
65
"net"
76

87
"github.com/sagernet/sing-box/adapter"
@@ -30,14 +29,7 @@ func NewURLTest(ctx context.Context, router adapter.Router, logger log.ContextLo
3029
if err != nil {
3130
return nil, err
3231
}
33-
switch o := outbound.(type) {
34-
case *group.URLTest:
35-
return &URLTest{o}, nil
36-
case *URLTest:
37-
return o, nil
38-
default:
39-
return nil, fmt.Errorf("unexpected outbound type: %T", outbound)
40-
}
32+
return &URLTest{outbound.(*group.URLTest)}, nil
4133
}
4234

4335
func (s *URLTest) DialContext(ctx context.Context, network string, destination metadata.Socksaddr) (net.Conn, error) {

0 commit comments

Comments
 (0)