0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-14 20:39:36 +03:00

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
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)
}
}