Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
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
Railgun
Coredns
Commits
654b88d8
Commit
654b88d8
authored
Feb 28, 2018
by
Miek Gieben
Committed by
GitHub
Feb 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
just use setup (#1574)
All these functions are namespaced by their package anyway; just use setup().
parent
4f3dc207
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
18 deletions
+18
-18
plugin/bind/bind.go
plugin/bind/bind.go
+1
-1
plugin/bind/bind_test.go
plugin/bind/bind_test.go
+2
-2
plugin/bind/setup.go
plugin/bind/setup.go
+1
-1
plugin/erratic/setup.go
plugin/erratic/setup.go
+2
-2
plugin/erratic/setup_test.go
plugin/erratic/setup_test.go
+4
-4
plugin/reverse/setup.go
plugin/reverse/setup.go
+2
-2
plugin/reverse/setup_test.go
plugin/reverse/setup_test.go
+1
-1
plugin/whoami/setup.go
plugin/whoami/setup.go
+2
-2
plugin/whoami/setup_test.go
plugin/whoami/setup_test.go
+3
-3
No files found.
plugin/bind/bind.go
View file @
654b88d8
...
@@ -6,6 +6,6 @@ import "github.com/mholt/caddy"
...
@@ -6,6 +6,6 @@ import "github.com/mholt/caddy"
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
"bind"
,
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"bind"
,
caddy
.
Plugin
{
ServerType
:
"dns"
,
ServerType
:
"dns"
,
Action
:
setup
Bind
,
Action
:
setup
,
})
})
}
}
plugin/bind/bind_test.go
View file @
654b88d8
...
@@ -8,7 +8,7 @@ import (
...
@@ -8,7 +8,7 @@ import (
"github.com/mholt/caddy"
"github.com/mholt/caddy"
)
)
func
TestSetup
Bind
(
t
*
testing
.
T
)
{
func
TestSetup
(
t
*
testing
.
T
)
{
for
i
,
test
:=
range
[]
struct
{
for
i
,
test
:=
range
[]
struct
{
config
string
config
string
expected
[]
string
expected
[]
string
...
@@ -22,7 +22,7 @@ func TestSetupBind(t *testing.T) {
...
@@ -22,7 +22,7 @@ func TestSetupBind(t *testing.T) {
{
`bind ::1 1.2.3.4 ::5 127.9.9.0 noone`
,
nil
,
true
},
{
`bind ::1 1.2.3.4 ::5 127.9.9.0 noone`
,
nil
,
true
},
}
{
}
{
c
:=
caddy
.
NewTestController
(
"dns"
,
test
.
config
)
c
:=
caddy
.
NewTestController
(
"dns"
,
test
.
config
)
err
:=
setup
Bind
(
c
)
err
:=
setup
(
c
)
if
err
!=
nil
{
if
err
!=
nil
{
if
!
test
.
failing
{
if
!
test
.
failing
{
t
.
Fatalf
(
"test %d, expected no errors, but got: %v"
,
i
,
err
)
t
.
Fatalf
(
"test %d, expected no errors, but got: %v"
,
i
,
err
)
...
...
plugin/bind/setup.go
View file @
654b88d8
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
"github.com/mholt/caddy"
"github.com/mholt/caddy"
)
)
func
setup
Bind
(
c
*
caddy
.
Controller
)
error
{
func
setup
(
c
*
caddy
.
Controller
)
error
{
config
:=
dnsserver
.
GetConfig
(
c
)
config
:=
dnsserver
.
GetConfig
(
c
)
// addresses will be consolidated over all BIND directives available in that BlocServer
// addresses will be consolidated over all BIND directives available in that BlocServer
...
...
plugin/erratic/setup.go
View file @
654b88d8
...
@@ -14,11 +14,11 @@ import (
...
@@ -14,11 +14,11 @@ import (
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
"erratic"
,
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"erratic"
,
caddy
.
Plugin
{
ServerType
:
"dns"
,
ServerType
:
"dns"
,
Action
:
setup
Erratic
,
Action
:
setup
,
})
})
}
}
func
setup
Erratic
(
c
*
caddy
.
Controller
)
error
{
func
setup
(
c
*
caddy
.
Controller
)
error
{
e
,
err
:=
parseErratic
(
c
)
e
,
err
:=
parseErratic
(
c
)
if
err
!=
nil
{
if
err
!=
nil
{
return
plugin
.
Error
(
"erratic"
,
err
)
return
plugin
.
Error
(
"erratic"
,
err
)
...
...
plugin/erratic/setup_test.go
View file @
654b88d8
...
@@ -6,23 +6,23 @@ import (
...
@@ -6,23 +6,23 @@ import (
"github.com/mholt/caddy"
"github.com/mholt/caddy"
)
)
func
TestSetup
Erratic
(
t
*
testing
.
T
)
{
func
TestSetup
(
t
*
testing
.
T
)
{
c
:=
caddy
.
NewTestController
(
"dns"
,
`erratic {
c
:=
caddy
.
NewTestController
(
"dns"
,
`erratic {
drop
drop
}`
)
}`
)
if
err
:=
setup
Erratic
(
c
);
err
!=
nil
{
if
err
:=
setup
(
c
);
err
!=
nil
{
t
.
Fatalf
(
"Test 1, expected no errors, but got: %q"
,
err
)
t
.
Fatalf
(
"Test 1, expected no errors, but got: %q"
,
err
)
}
}
c
=
caddy
.
NewTestController
(
"dns"
,
`erratic`
)
c
=
caddy
.
NewTestController
(
"dns"
,
`erratic`
)
if
err
:=
setup
Erratic
(
c
);
err
!=
nil
{
if
err
:=
setup
(
c
);
err
!=
nil
{
t
.
Fatalf
(
"Test 2, expected no errors, but got: %q"
,
err
)
t
.
Fatalf
(
"Test 2, expected no errors, but got: %q"
,
err
)
}
}
c
=
caddy
.
NewTestController
(
"dns"
,
`erratic {
c
=
caddy
.
NewTestController
(
"dns"
,
`erratic {
drop -1
drop -1
}`
)
}`
)
if
err
:=
setup
Erratic
(
c
);
err
==
nil
{
if
err
:=
setup
(
c
);
err
==
nil
{
t
.
Fatalf
(
"Test 4, expected errors, but got: %q"
,
err
)
t
.
Fatalf
(
"Test 4, expected errors, but got: %q"
,
err
)
}
}
}
}
...
...
plugin/reverse/setup.go
View file @
654b88d8
...
@@ -17,11 +17,11 @@ import (
...
@@ -17,11 +17,11 @@ import (
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
"reverse"
,
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"reverse"
,
caddy
.
Plugin
{
ServerType
:
"dns"
,
ServerType
:
"dns"
,
Action
:
setup
Reverse
,
Action
:
setup
,
})
})
}
}
func
setup
Reverse
(
c
*
caddy
.
Controller
)
error
{
func
setup
(
c
*
caddy
.
Controller
)
error
{
networks
,
fall
,
err
:=
reverseParse
(
c
)
networks
,
fall
,
err
:=
reverseParse
(
c
)
if
err
!=
nil
{
if
err
!=
nil
{
return
plugin
.
Error
(
"reverse"
,
err
)
return
plugin
.
Error
(
"reverse"
,
err
)
...
...
plugin/reverse/setup_test.go
View file @
654b88d8
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
"github.com/mholt/caddy"
"github.com/mholt/caddy"
)
)
func
TestSetup
Parse
(
t
*
testing
.
T
)
{
func
TestSetup
(
t
*
testing
.
T
)
{
_
,
net4
,
_
:=
net
.
ParseCIDR
(
"10.1.1.0/24"
)
_
,
net4
,
_
:=
net
.
ParseCIDR
(
"10.1.1.0/24"
)
_
,
net6
,
_
:=
net
.
ParseCIDR
(
"fd01::/64"
)
_
,
net6
,
_
:=
net
.
ParseCIDR
(
"fd01::/64"
)
...
...
plugin/whoami/setup.go
View file @
654b88d8
...
@@ -10,11 +10,11 @@ import (
...
@@ -10,11 +10,11 @@ import (
func
init
()
{
func
init
()
{
caddy
.
RegisterPlugin
(
"whoami"
,
caddy
.
Plugin
{
caddy
.
RegisterPlugin
(
"whoami"
,
caddy
.
Plugin
{
ServerType
:
"dns"
,
ServerType
:
"dns"
,
Action
:
setup
Whoami
,
Action
:
setup
,
})
})
}
}
func
setup
Whoami
(
c
*
caddy
.
Controller
)
error
{
func
setup
(
c
*
caddy
.
Controller
)
error
{
c
.
Next
()
// 'whoami'
c
.
Next
()
// 'whoami'
if
c
.
NextArg
()
{
if
c
.
NextArg
()
{
return
plugin
.
Error
(
"whoami"
,
c
.
ArgErr
())
return
plugin
.
Error
(
"whoami"
,
c
.
ArgErr
())
...
...
plugin/whoami/setup_test.go
View file @
654b88d8
...
@@ -6,14 +6,14 @@ import (
...
@@ -6,14 +6,14 @@ import (
"github.com/mholt/caddy"
"github.com/mholt/caddy"
)
)
func
TestSetup
Whoami
(
t
*
testing
.
T
)
{
func
TestSetup
(
t
*
testing
.
T
)
{
c
:=
caddy
.
NewTestController
(
"dns"
,
`whoami`
)
c
:=
caddy
.
NewTestController
(
"dns"
,
`whoami`
)
if
err
:=
setup
Whoami
(
c
);
err
!=
nil
{
if
err
:=
setup
(
c
);
err
!=
nil
{
t
.
Fatalf
(
"Expected no errors, but got: %v"
,
err
)
t
.
Fatalf
(
"Expected no errors, but got: %v"
,
err
)
}
}
c
=
caddy
.
NewTestController
(
"dns"
,
`whoami example.org`
)
c
=
caddy
.
NewTestController
(
"dns"
,
`whoami example.org`
)
if
err
:=
setup
Whoami
(
c
);
err
==
nil
{
if
err
:=
setup
(
c
);
err
==
nil
{
t
.
Fatalf
(
"Expected errors, but got: %v"
,
err
)
t
.
Fatalf
(
"Expected errors, but got: %v"
,
err
)
}
}
}
}
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