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
d3aedbeb
Commit
d3aedbeb
authored
May 04, 2015
by
Nimi Wariboko Jr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: add bindaddr directive, allowing you to specify what address to listen on
parent
2dbd14b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
config/directives.go
config/directives.go
+1
-0
config/setup/bindaddr.go
config/setup/bindaddr.go
+12
-0
server/config.go
server/config.go
+6
-0
No files found.
config/directives.go
View file @
d3aedbeb
...
...
@@ -43,6 +43,7 @@ var directiveOrder = []directive{
// Essential directives that initialize vital configuration settings
{
"root"
,
setup
.
Root
},
{
"tls"
,
setup
.
TLS
},
{
"bindaddr"
,
setup
.
BindAddr
},
// Other directives that don't create HTTP handlers
{
"startup"
,
setup
.
Startup
},
...
...
config/setup/bindaddr.go
0 → 100644
View file @
d3aedbeb
package
setup
import
"github.com/mholt/caddy/middleware"
func
BindAddr
(
c
*
Controller
)
(
middleware
.
Middleware
,
error
)
{
for
c
.
Next
()
{
if
!
c
.
Args
(
&
c
.
BindAddress
)
{
return
nil
,
c
.
ArgErr
()
}
}
return
nil
,
nil
}
server/config.go
View file @
d3aedbeb
...
...
@@ -11,6 +11,9 @@ type Config struct {
// The hostname or IP on which to serve
Host
string
// The address to bind on - defaults to Host if empty
BindAddress
string
// The port to listen on
Port
string
...
...
@@ -44,6 +47,9 @@ type Config struct {
// Address returns the host:port of c as a string.
func
(
c
Config
)
Address
()
string
{
if
c
.
BindAddress
!=
""
{
return
net
.
JoinHostPort
(
c
.
BindAddress
,
c
.
Port
)
}
return
net
.
JoinHostPort
(
c
.
Host
,
c
.
Port
)
}
...
...
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