Add observatory / latestPing balancing strategy

Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
This commit is contained in:
世界 2021-04-09 05:20:30 +08:00
parent 77d0419aca
commit 5c366db847
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
21 changed files with 1127 additions and 31 deletions

View file

@ -1,7 +1,10 @@
package router
import (
"context"
"github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/features/extension"
"github.com/xtls/xray-core/features/outbound"
)
@ -41,3 +44,8 @@ func (b *Balancer) PickOutbound() (string, error) {
}
return tag, nil
}
func (b *Balancer) InjectContext(ctx context.Context) {
if contextReceiver, ok := b.strategy.(extension.ContextReceiver); ok {
contextReceiver.InjectContext(ctx)
}
}