Skip to content

Commit

Permalink
update to v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
crackair committed Mar 31, 2022
1 parent c5060e5 commit a9ab3f5
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 61 deletions.
106 changes: 50 additions & 56 deletions app/mydispatcher/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions app/mydispatcher/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type DefaultDispatcher struct {
router routing.Router
policy policy.Manager
stats stats.Manager
hosts dns.HostsLookup
hosts dns.HostsLookup
Limiter *limiter.Limiter
RuleManager *rule.RuleManager
}
Expand Down Expand Up @@ -139,7 +139,7 @@ func (*DefaultDispatcher) Start() error {
// Close implements common.Closable.
func (*DefaultDispatcher) Close() error { return nil }

func (d *DefaultDispatcher) getLink(ctx context.Context) (*transport.Link, *transport.Link) {
func (d *DefaultDispatcher) getLink(ctx context.Context) (*transport.Link, *transport.Link, error) {
opt := pipe.OptionsFromContext(ctx)
uplinkReader, uplinkWriter := pipe.New(opt...)
downlinkReader, downlinkWriter := pipe.New(opt...)
Expand Down Expand Up @@ -169,6 +169,7 @@ func (d *DefaultDispatcher) getLink(ctx context.Context) (*transport.Link, *tran
common.Close(inboundLink.Writer)
common.Interrupt(outboundLink.Reader)
common.Interrupt(inboundLink.Reader)
return nil, nil, newError("Devices reach the limit: ", user.Email)
}
if ok {
inboundLink.Writer = d.Limiter.RateWriter(inboundLink.Writer, bucket)
Expand All @@ -195,7 +196,7 @@ func (d *DefaultDispatcher) getLink(ctx context.Context) (*transport.Link, *tran
}
}

return inboundLink, outboundLink
return inboundLink, outboundLink, nil
}

func shouldOverride(ctx context.Context, result SniffResult, request session.SniffingRequest, destination net.Destination) bool {
Expand Down Expand Up @@ -242,7 +243,10 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
}
ctx = session.ContextWithOutbound(ctx, ob)

inbound, outbound := d.getLink(ctx)
inbound, outbound, err := d.getLink(ctx)
if err != nil {
return nil, err
}
content := session.ContentFromContext(ctx)
if content == nil {
content = new(session.Content)
Expand Down
2 changes: 1 addition & 1 deletion main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
)

var (
version = "0.7.6"
version = "0.8.0"
codename = "XrayR"
intro = "A Xray backend that supports many panels"
)
Expand Down

0 comments on commit a9ab3f5

Please sign in to comment.