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
nexedi
caddy
Commits
8cdc65ed
Commit
8cdc65ed
authored
Aug 19, 2016
by
Matt Holt
Committed by
GitHub
Aug 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1048 from miekg/missingbits
Implement missing bits for an external servertype
parents
fdc62d01
a609fa5f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
caddy.go
caddy.go
+7
-4
plugins.go
plugins.go
+20
-2
No files found.
caddy.go
View file @
8cdc65ed
...
@@ -76,7 +76,7 @@ type Instance struct {
...
@@ -76,7 +76,7 @@ type Instance struct {
context
Context
context
Context
// servers is the list of servers with their listeners.
// servers is the list of servers with their listeners.
servers
[]
s
erverListener
servers
[]
S
erverListener
// these callbacks execute when certain events occur
// these callbacks execute when certain events occur
onFirstStartup
[]
func
()
error
// starting, not as part of a restart
onFirstStartup
[]
func
()
error
// starting, not as part of a restart
...
@@ -86,6 +86,9 @@ type Instance struct {
...
@@ -86,6 +86,9 @@ type Instance struct {
onFinalShutdown
[]
func
()
error
// stopping, not as part of a restart
onFinalShutdown
[]
func
()
error
// stopping, not as part of a restart
}
}
// Servers returns the ServerListeners in i.
func
(
i
*
Instance
)
Servers
()
[]
ServerListener
{
return
i
.
servers
}
// Stop stops all servers contained in i. It does NOT
// Stop stops all servers contained in i. It does NOT
// execute shutdown callbacks.
// execute shutdown callbacks.
func
(
i
*
Instance
)
Stop
()
error
{
func
(
i
*
Instance
)
Stop
()
error
{
...
@@ -202,7 +205,7 @@ func (i *Instance) Restart(newCaddyfile Input) (*Instance, error) {
...
@@ -202,7 +205,7 @@ func (i *Instance) Restart(newCaddyfile Input) (*Instance, error) {
// internally-kept list of servers that is running. For
// internally-kept list of servers that is running. For
// saved servers, graceful restarts will be provided.
// saved servers, graceful restarts will be provided.
func
(
i
*
Instance
)
SaveServer
(
s
Server
,
ln
net
.
Listener
)
{
func
(
i
*
Instance
)
SaveServer
(
s
Server
,
ln
net
.
Listener
)
{
i
.
servers
=
append
(
i
.
servers
,
s
erverListener
{
server
:
s
,
listener
:
ln
})
i
.
servers
=
append
(
i
.
servers
,
S
erverListener
{
server
:
s
,
listener
:
ln
})
}
}
// HasListenerWithAddress returns whether this package is
// HasListenerWithAddress returns whether this package is
...
@@ -644,7 +647,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
...
@@ -644,7 +647,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
errChan
<-
s
.
ServePacket
(
pc
)
errChan
<-
s
.
ServePacket
(
pc
)
}(
s
,
ln
,
pc
,
inst
)
}(
s
,
ln
,
pc
,
inst
)
inst
.
servers
=
append
(
inst
.
servers
,
s
erverListener
{
server
:
s
,
listener
:
ln
,
packet
:
pc
})
inst
.
servers
=
append
(
inst
.
servers
,
S
erverListener
{
server
:
s
,
listener
:
ln
,
packet
:
pc
})
}
}
// Log errors that may be returned from Serve() calls,
// Log errors that may be returned from Serve() calls,
...
@@ -836,7 +839,7 @@ var (
...
@@ -836,7 +839,7 @@ var (
instancesMu
sync
.
Mutex
instancesMu
sync
.
Mutex
)
)
const
(
var
(
// DefaultConfigFile is the name of the configuration file that is loaded
// DefaultConfigFile is the name of the configuration file that is loaded
// by default if no other file is specified.
// by default if no other file is specified.
DefaultConfigFile
=
"Caddyfile"
DefaultConfigFile
=
"Caddyfile"
...
...
plugins.go
View file @
8cdc65ed
...
@@ -82,13 +82,31 @@ func ValidDirectives(serverType string) []string {
...
@@ -82,13 +82,31 @@ func ValidDirectives(serverType string) []string {
return
stype
.
Directives
return
stype
.
Directives
}
}
//
s
erverListener pairs a server to its listener and/or packetconn.
//
S
erverListener pairs a server to its listener and/or packetconn.
type
s
erverListener
struct
{
type
S
erverListener
struct
{
server
Server
server
Server
listener
net
.
Listener
listener
net
.
Listener
packet
net
.
PacketConn
packet
net
.
PacketConn
}
}
// LocalAddr returns the local network address of the packetconn. It returns
// nil when it is not set.
func
(
s
ServerListener
)
LocalAddr
()
net
.
Addr
{
if
s
.
packet
==
nil
{
return
nil
}
return
s
.
packet
.
LocalAddr
()
}
// Addr returns the listener's network address. It returns nil when it is
// not set.
func
(
s
ServerListener
)
Addr
()
net
.
Addr
{
if
s
.
listener
==
nil
{
return
nil
}
return
s
.
listener
.
Addr
()
}
// Context is a type which carries a server type through
// Context is a type which carries a server type through
// the load and setup phase; it maintains the state
// the load and setup phase; it maintains the state
// between loading the Caddyfile, then executing its
// between loading the Caddyfile, then executing its
...
...
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