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
59c6513b
Commit
59c6513b
authored
Jul 18, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify some godoc
parent
aede4ccb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
caddy.go
caddy.go
+27
-16
No files found.
caddy.go
View file @
59c6513b
...
@@ -235,37 +235,48 @@ func listenerAddrEqual(ln net.Listener, addr string) bool {
...
@@ -235,37 +235,48 @@ func listenerAddrEqual(ln net.Listener, addr string) bool {
return
false
return
false
}
}
// Server is a type that can listen and serve. A Server
// Server is a type that can listen and serve.
// must associate with exactly zero or one listeners and packetconns.
//
// The listed method "pair up", Listen() and Serve() are needed for a
// These methods must be implemented in pairs. If the server uses
// TCP server and ListenPacket() and ServePacket() are needed for a
// TCP, it should implement Listen() and Serve(). If it uses UDP
// UDP server. Do both TCP and UDP means all four are needed.
// or some other protocol, it should implement ListenPacket() and
// ServePacket(). If it uses both, all four methods should be
// implemented. Any unimplemented methods should be made as no-ops
// that simply return nil values.
//
// A Server must associate with exactly or one listeners and
// zero or one packetconns.
type
Server
interface
{
type
Server
interface
{
// TCP methods
// Listen starts listening by creating a new listener
// Listen starts listening by creating a new listener
// and returning it. It does not start accepting
// and returning it. It does not start accepting
// connections.
// connections. For UDP-only servers, this method
// can be a no-op that returns (nil, nil).
Listen
()
(
net
.
Listener
,
error
)
Listen
()
(
net
.
Listener
,
error
)
// ListenPacket starts listening by creating a new packetconn
// and returning it. It does not start accepting connections.
// For a TCP only server this method can be a noop and just
// return (nil, nil).
ListenPacket
()
(
net
.
PacketConn
,
error
)
// Serve starts serving using the provided listener.
// Serve starts serving using the provided listener.
// Serve must start the server loop nearly immediately,
// Serve must start the server loop nearly immediately,
// or at least not return any errors before the server
// or at least not return any errors before the server
// loop begins. Serve blocks indefinitely, or in other
// loop begins. Serve blocks indefinitely, or in other
// words, until the server is stopped.
// words, until the server is stopped. For UDP-only
// servers, this method can be a no-op that returns nil.
Serve
(
net
.
Listener
)
error
Serve
(
net
.
Listener
)
error
// UDP methods
// ListenPacket starts listening by creating a new packetconn
// and returning it. It does not start accepting connections.
// TCP-only servers may leave this method blank and return
// (nil, nil).
ListenPacket
()
(
net
.
PacketConn
,
error
)
// ServePacket starts serving using the provided packetconn.
// ServePacket starts serving using the provided packetconn.
// ServePacket must start the server loop nearly immediately,
// ServePacket must start the server loop nearly immediately,
// or at least not return any errors before the server
// or at least not return any errors before the server
// loop begins. ServePacket blocks indefinitely, or in other
// loop begins. ServePacket blocks indefinitely, or in other
// words, until the server is stopped.
// words, until the server is stopped. For TCP-only servers,
// For a TCP only server this method can be a noop and just
// this method can be a no-op that returns nil.
// return nil.
ServePacket
(
net
.
PacketConn
)
error
ServePacket
(
net
.
PacketConn
)
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