This commit is contained in:
crusader 2018-04-10 13:02:00 +09:00
parent 265d562d31
commit 40422f2d22

View File

@ -2,7 +2,6 @@ package server
import ( import (
"crypto/tls" "crypto/tls"
"fmt"
"net" "net"
"time" "time"
) )
@ -20,16 +19,21 @@ type ConnectionHandlers struct {
// The maximum number of concurrent connections the server may serve. // The maximum number of concurrent connections the server may serve.
// //
// DefaultConcurrency is used if not set. // DefaultConcurrency is used if not set.
Network string `json:"network"` Network string `json:"network"`
Address string `json:"address"` Address string `json:"address"`
Concurrency int `json:"concurrency"` Concurrency int `json:"concurrency"`
KeepAlive time.Duration `json:"keepAlive"` KeepAlive time.Duration `json:"keepAlive"`
HandshakeTimeout time.Duration `json:"handshakeTimeout"` HandshakeTimeout time.Duration `json:"handshakeTimeout"`
TLSConfig *tls.Config TLSConfig *tls.Config
} }
func (ch *ConnectionHandlers) Listener(serverCtx ServerCtx) (net.Listener, error) { func (ch *ConnectionHandlers) Listener(serverCtx ServerCtx) (net.Listener, error) {
return nil, fmt.Errorf("Method[ConnectionHandler.Listener] is not implemented") l, err := net.Listen(ch.Network, ch.Address)
if nil != err {
return nil, err
}
return l, nil
} }
func (ch *ConnectionHandlers) GetConcurrency() int { func (ch *ConnectionHandlers) GetConcurrency() int {