Feat: support load-balance

This commit is contained in:
Dreamacro 2019-02-18 20:44:32 +08:00
parent bf6299a79d
commit 78053e77cf
3 changed files with 10 additions and 8 deletions

View File

@ -23,7 +23,7 @@
display: block;
height: 24px;
line-height: 24px;
width: 80px;
width: 100px;
text-align: center;
background-color: $color-primary-dark;
color: #fff;

View File

@ -29,7 +29,6 @@ export interface ShadowsocksProxy {
obfs?: string
'obfs-host'?: string
}
export const VmessProxyConfigList = [
@ -51,7 +50,6 @@ export interface VmessProxy {
cipher?: string
tls?: boolean
}
export const Socks5ProxyConfigList = ['name', 'type', 'server', 'port']
@ -63,10 +61,9 @@ export interface Socks5Proxy {
server?: string
port?: number
}
export type ProxyGroup = SelectProxyGroup & UrlTestProxyGroup & FallbackProxyGroup
export type ProxyGroup = SelectProxyGroup & UrlTestProxyGroup & FallbackProxyGroup & LoadBalanceGroup
export interface SelectProxyGroup {
name?: string
@ -74,7 +71,14 @@ export interface SelectProxyGroup {
type?: 'select'
proxies?: string[] // proxy names
}
export interface LoadBalanceGroup {
name?: string
type?: 'load-balance'
proxies?: string[] // proxy names
}
export interface FallbackProxyGroup {
@ -87,7 +91,6 @@ export interface FallbackProxyGroup {
url?: string
interval?: number // second
}
export interface UrlTestProxyGroup {
@ -100,5 +103,4 @@ export interface UrlTestProxyGroup {
url?: string
interval?: number // second
}

View File

@ -68,7 +68,7 @@ export class ConfigStore {
allowLan: general['allow-lan']
}
const policyGroup = new Set(['Selector', 'URLTest', 'Fallback'])
const policyGroup = new Set(['Selector', 'URLTest', 'Fallback', 'LoadBalance'])
const unUsedProxy = new Set(['DIRECT', 'REJECT', 'GLOBAL'])
const proxies = Object.keys(rawProxies.data.proxies)
.filter(key => !unUsedProxy.has(key))