proxygen
wangle::ServerSocketConfig Struct Reference

#include <ServerSocketConfig.h>

Inheritance diagram for wangle::ServerSocketConfig:
proxygen::AcceptorConfiguration

Public Member Functions

 ServerSocketConfig ()
 
bool isSSL () const
 
void setSocketOptions (const folly::AsyncSocket::OptionMap &opts)
 
folly::AsyncSocket::OptionMapgetSocketOptions ()
 
const folly::AsyncSocket::OptionMapgetSocketOptions () const
 
bool hasExternalPrivateKey () const
 

Public Attributes

std::string name
 
uint32_t acceptBacklog {1024}
 
uint32_t maxNumPendingConnectionsPerWorker {1024}
 
std::chrono::milliseconds connectionIdleTimeout {600000}
 
std::chrono::milliseconds sslHandshakeTimeout {60000}
 
folly::SocketAddress bindAddress
 
SSLCacheOptions sslCacheOptions {std::chrono::seconds(0), 20480, 200}
 
bool allowInsecureConnectionsOnSecureServer {false}
 
TLSTicketKeySeeds initialTicketSeeds
 
std::vector< SSLContextConfigsslContextConfigs
 
bool strictSSL {true}
 
uint32_t maxConcurrentSSLHandshakes {30720}
 
bool enableTCPFastOpen {false}
 
uint32_t fastOpenQueueSize {100}
 
FizzConfig fizzConfig
 

Private Attributes

folly::AsyncSocket::OptionMap socketOptions_
 

Detailed Description

Configuration for a single Acceptor.

This configures not only accept behavior, but also some types of SSL behavior that may make sense to configure on a per-VIP basis (e.g. which cert(s) we use, etc).

Definition at line 48 of file ServerSocketConfig.h.

Constructor & Destructor Documentation

wangle::ServerSocketConfig::ServerSocketConfig ( )
inline

Definition at line 49 of file ServerSocketConfig.h.

References wangle::TLSTicketKeySeeds::currentSeeds, wangle::SSLUtil::hexlify(), initialTicketSeeds, folly::Random::secureRandom(), seed, string, and uint8_t.

49  {
50  // generate a single random current seed
51  uint8_t seed[32];
52  folly::Random::secureRandom(seed, sizeof(seed));
54  SSLUtil::hexlify(std::string((char *)seed, sizeof(seed))));
55  }
std::vector< std::string > currentSeeds
static std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, T >::type secureRandom()
Definition: Random.h:112
static const int seed
TLSTicketKeySeeds initialTicketSeeds
const char * string
Definition: Conv.cpp:212
static std::string hexlify(const std::string &binary)
Definition: SSLUtil.h:150

Member Function Documentation

folly::AsyncSocket::OptionMap& wangle::ServerSocketConfig::getSocketOptions ( )
inline

Definition at line 67 of file ServerSocketConfig.h.

References socketOptions_.

67  {
68  return socketOptions_;
69  }
folly::AsyncSocket::OptionMap socketOptions_
const folly::AsyncSocket::OptionMap& wangle::ServerSocketConfig::getSocketOptions ( ) const
inline

Definition at line 71 of file ServerSocketConfig.h.

References socketOptions_.

71  {
72  return socketOptions_;
73  }
folly::AsyncSocket::OptionMap socketOptions_
bool wangle::ServerSocketConfig::hasExternalPrivateKey ( ) const
inline

Definition at line 75 of file ServerSocketConfig.h.

References sslContextConfigs.

75  {
76  for (const auto& cfg : sslContextConfigs) {
77  if (!cfg.isLocalPrivateKey) {
78  return true;
79  }
80  }
81  return false;
82  }
std::vector< SSLContextConfig > sslContextConfigs
bool wangle::ServerSocketConfig::isSSL ( ) const
inline

Definition at line 57 of file ServerSocketConfig.h.

References sslContextConfigs.

Referenced by wangle::Acceptor::init(), wangle::Acceptor::isSSL(), and wangle::Acceptor::processEstablishedConnection().

57 { return !(sslContextConfigs.empty()); }
std::vector< SSLContextConfig > sslContextConfigs
void wangle::ServerSocketConfig::setSocketOptions ( const folly::AsyncSocket::OptionMap opts)
inline

Set/get the socket options to apply on all downstream connections.

Definition at line 62 of file ServerSocketConfig.h.

References bindAddress, wangle::filterIPSocketOptions(), folly::SocketAddress::getFamily(), and socketOptions_.

Referenced by proxygen::HTTPServerAcceptor::makeConfig().

63  {
65  }
folly::SocketAddress bindAddress
sa_family_t getFamily() const
folly::AsyncSocket::OptionMap socketOptions_
AsyncSocket::OptionMap filterIPSocketOptions(const AsyncSocket::OptionMap &allOptions, const int addrFamily)

Member Data Documentation

bool wangle::ServerSocketConfig::allowInsecureConnectionsOnSecureServer {false}

Determines whether or not to allow insecure connections over a secure port. Can be used to multiplex TLS and plaintext on the same port for some services.

Definition at line 124 of file ServerSocketConfig.h.

Referenced by wangle::Acceptor::init(), main(), and proxygen::HTTPServerAcceptor::makeConfig().

std::chrono::milliseconds wangle::ServerSocketConfig::connectionIdleTimeout {600000}

The number of milliseconds a connection can be idle before we close it.

Definition at line 102 of file ServerSocketConfig.h.

Referenced by wangle::Acceptor::getConnTimeout(), wangle::Acceptor::initDownstreamConnectionManager(), and proxygen::HTTPServerAcceptor::makeConfig().

bool wangle::ServerSocketConfig::enableTCPFastOpen {false}

Whether to enable TCP fast open. Before turning this option on, for it to work, it must also be enabled on the machine via /proc/sys/net/ipv4/tcp_fastopen, and the keys for TFO should also be set at /proc/sys/net/ipv4/tcp_fastopen_key

Definition at line 153 of file ServerSocketConfig.h.

Referenced by proxygen::HTTPServerAcceptor::makeConfig(), and wangle::AsyncServerSocketFactory::newSocket().

uint32_t wangle::ServerSocketConfig::fastOpenQueueSize {100}

Limit on size of queue of TFO requests by clients.

Definition at line 158 of file ServerSocketConfig.h.

Referenced by proxygen::HTTPServerAcceptor::makeConfig(), and wangle::AsyncServerSocketFactory::newSocket().

FizzConfig wangle::ServerSocketConfig::fizzConfig
TLSTicketKeySeeds wangle::ServerSocketConfig::initialTicketSeeds
uint32_t wangle::ServerSocketConfig::maxConcurrentSSLHandshakes {30720}

Maximum number of concurrent pending SSL handshakes

Definition at line 145 of file ServerSocketConfig.h.

Referenced by wangle::Acceptor::processEstablishedConnection().

uint32_t wangle::ServerSocketConfig::maxNumPendingConnectionsPerWorker {1024}

The maximum number of pending connections each io worker thread can hold.

Definition at line 97 of file ServerSocketConfig.h.

Referenced by wangle::ServerBootstrap< DefaultPipeline >::bind(), and wangle::AsyncServerSocketFactory::newSocket().

std::string wangle::ServerSocketConfig::name

The name of this acceptor; used for stats/reporting purposes.

Definition at line 87 of file ServerSocketConfig.h.

Referenced by wangle::Acceptor::getName(), and wangle::Acceptor::processEstablishedConnection().

folly::AsyncSocket::OptionMap wangle::ServerSocketConfig::socketOptions_
private

Definition at line 163 of file ServerSocketConfig.h.

Referenced by getSocketOptions(), and setSocketOptions().

SSLCacheOptions wangle::ServerSocketConfig::sslCacheOptions {std::chrono::seconds(0), 20480, 200}
std::chrono::milliseconds wangle::ServerSocketConfig::sslHandshakeTimeout {60000}

The number of milliseconds a ssl handshake can timeout (60s)

Definition at line 107 of file ServerSocketConfig.h.

Referenced by wangle::Acceptor::getSSLHandshakeTimeout().

bool wangle::ServerSocketConfig::strictSSL {true}

Determines if the Acceptor does strict checking when loading the SSL contexts.

Definition at line 140 of file ServerSocketConfig.h.

Referenced by wangle::Acceptor::init(), and proxygen::HTTPServerAcceptor::makeConfig().


The documentation for this struct was generated from the following file: