Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
dd946f8a
Commit
dd946f8a
authored
May 28, 2015
by
Austin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved init to policy.go
parent
593aec9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
middleware/proxy/policy.go
middleware/proxy/policy.go
+6
-0
middleware/proxy/upstream.go
middleware/proxy/upstream.go
+0
-6
No files found.
middleware/proxy/policy.go
View file @
dd946f8a
...
@@ -13,6 +13,12 @@ type Policy interface {
...
@@ -13,6 +13,12 @@ type Policy interface {
Select
(
pool
HostPool
)
*
UpstreamHost
Select
(
pool
HostPool
)
*
UpstreamHost
}
}
func
init
()
{
RegisterPolicy
(
"random"
,
func
()
Policy
{
return
&
Random
{}
})
RegisterPolicy
(
"least_conn"
,
func
()
Policy
{
return
&
LeastConn
{}
})
RegisterPolicy
(
"round_robin"
,
func
()
Policy
{
return
&
RoundRobin
{}
})
}
// Random is a policy that selects up hosts from a pool at random.
// Random is a policy that selects up hosts from a pool at random.
type
Random
struct
{}
type
Random
struct
{}
...
...
middleware/proxy/upstream.go
View file @
dd946f8a
...
@@ -27,12 +27,6 @@ type staticUpstream struct {
...
@@ -27,12 +27,6 @@ type staticUpstream struct {
}
}
}
}
func
init
()
{
RegisterPolicy
(
"random"
,
func
()
Policy
{
return
&
Random
{}
})
RegisterPolicy
(
"least_conn"
,
func
()
Policy
{
return
&
LeastConn
{}
})
RegisterPolicy
(
"round_robin"
,
func
()
Policy
{
return
&
RoundRobin
{}
})
}
// NewStaticUpstreams parses the configuration input and sets up
// NewStaticUpstreams parses the configuration input and sets up
// static upstreams for the proxy middleware.
// static upstreams for the proxy middleware.
func
NewStaticUpstreams
(
c
parse
.
Dispenser
)
([]
Upstream
,
error
)
{
func
NewStaticUpstreams
(
c
parse
.
Dispenser
)
([]
Upstream
,
error
)
{
...
...
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