-
Notifications
You must be signed in to change notification settings - Fork 23
/
listener.h
54 lines (45 loc) · 1.29 KB
/
listener.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
This file is part of FlashMQ (https://www.flashmq.org)
Copyright (C) 2021-2023 Wiebe Cazemier
FlashMQ is free software: you can redistribute it and/or modify
it under the terms of The Open Software License 3.0 (OSL-3.0).
See LICENSE for license details.
*/
#ifndef LISTENER_H
#define LISTENER_H
#include <string>
#include <memory>
#include "sslctxmanager.h"
#include "enums.h"
enum class ListenerProtocol
{
IPv46,
IPv4,
IPv6
};
struct Listener
{
ListenerProtocol protocol = ListenerProtocol::IPv46;
std::string inet4BindAddress;
std::string inet6BindAddress;
int port = 0;
bool websocket = false;
bool tcpNoDelay = false;
bool haproxy = false;
std::string sslFullchain;
std::string sslPrivkey;
std::string clientVerificationCaFile;
std::string clientVerificationCaDir;
bool clientVerifictionStillDoAuthn = false;
std::unique_ptr<SslCtxManager> sslctx;
AllowListenerAnonymous allowAnonymous = AllowListenerAnonymous::None;
void isValid();
bool isSsl() const;
bool isHaProxy() const;
bool isTcpNoDelay() const;
std::string getProtocolName() const;
void loadCertAndKeyFromConfig();
X509ClientVerification getX509ClientVerficationMode() const;
std::string getBindAddress(ListenerProtocol p);
};
#endif // LISTENER_H