Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
e8ad44ca
Commit
e8ad44ca
authored
Jun 19, 2019
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add max_fails & fail_timeout options support for load balancing
parent
f89062a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
+27
-8
cmd/gost/route.go
cmd/gost/route.go
+11
-2
node.go
node.go
+14
-4
socks.go
socks.go
+2
-2
No files found.
cmd/gost/route.go
View file @
e8ad44ca
...
@@ -51,11 +51,20 @@ func (r *route) parseChain() (*gost.Chain, error) {
...
@@ -51,11 +51,20 @@ func (r *route) parseChain() (*gost.Chain, error) {
}
}
ngroup
.
AddNode
(
nodes
...
)
ngroup
.
AddNode
(
nodes
...
)
maxFails
:=
nodes
[
0
]
.
GetInt
(
"max_fails"
)
if
maxFails
==
0
{
maxFails
=
defaultMaxFails
}
failTimeout
:=
nodes
[
0
]
.
GetDuration
(
"fail_timeout"
)
if
failTimeout
==
0
{
failTimeout
=
defaultFailTimeout
}
ngroup
.
SetSelector
(
nil
,
ngroup
.
SetSelector
(
nil
,
gost
.
WithFilter
(
gost
.
WithFilter
(
&
gost
.
FailFilter
{
&
gost
.
FailFilter
{
MaxFails
:
defaultM
axFails
,
MaxFails
:
m
axFails
,
FailTimeout
:
defaultF
ailTimeout
,
FailTimeout
:
f
ailTimeout
,
},
},
&
gost
.
InvalidFilter
{},
&
gost
.
InvalidFilter
{},
),
),
...
...
node.go
View file @
e8ad44ca
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"sync"
"sync"
"time"
)
)
var
(
var
(
...
@@ -140,12 +141,21 @@ func (node *Node) GetInt(key string) int {
...
@@ -140,12 +141,21 @@ func (node *Node) GetInt(key string) int {
return
n
return
n
}
}
func
(
node
*
Node
)
GetDuration
(
key
string
)
time
.
Duration
{
d
,
_
:=
time
.
ParseDuration
(
node
.
Values
.
Get
(
key
))
return
d
}
func
(
node
Node
)
String
()
string
{
func
(
node
Node
)
String
()
string
{
if
node
.
url
==
nil
{
var
scheme
string
return
fmt
.
Sprintf
(
"%s+%s://%s"
,
if
node
.
url
!=
nil
{
node
.
Protocol
,
node
.
Transport
,
node
.
Addr
)
scheme
=
node
.
url
.
Scheme
}
if
scheme
==
""
{
scheme
=
fmt
.
Sprintf
(
"%s+%s"
,
node
.
Protocol
,
node
.
Transport
)
}
}
return
node
.
url
.
String
()
return
fmt
.
Sprintf
(
"%s://%s"
,
scheme
,
node
.
Addr
)
}
}
// NodeGroup is a group of nodes.
// NodeGroup is a group of nodes.
...
...
socks.go
View file @
e8ad44ca
...
@@ -19,9 +19,9 @@ import (
...
@@ -19,9 +19,9 @@ import (
)
)
const
(
const
(
// MethodTLS is an extended SOCKS5 method
for TLS
.
// MethodTLS is an extended SOCKS5 method
with tls encryption support
.
MethodTLS
uint8
=
0x80
MethodTLS
uint8
=
0x80
// MethodTLSAuth is an extended SOCKS5 method
for TLS+AUTH
.
// MethodTLSAuth is an extended SOCKS5 method
with tls encryption and authentication support
.
MethodTLSAuth
uint8
=
0x82
MethodTLSAuth
uint8
=
0x82
// MethodMux is an extended SOCKS5 method for stream multiplexing.
// MethodMux is an extended SOCKS5 method for stream multiplexing.
MethodMux
=
0x88
MethodMux
=
0x88
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment