OpenVPN 3 Core Library
Loading...
Searching...
No Matches
quoteip.hpp
Go to the documentation of this file.
1// OpenVPN -- An application to securely tunnel IP networks
2// over a single port, with support for SSL/TLS-based
3// session authentication and key exchange,
4// packet encryption, packet authentication, and
5// packet compression.
6//
7// Copyright (C) 2012- OpenVPN Inc.
8//
9// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10//
11
12#pragma once
13
14#include <string>
15
16namespace openvpn {
17
18// return ip_addr in brackets if it is IPv6
19std::string quote_ip(const std::string &ip_addr)
20{
21 if (ip_addr.find(':') != std::string::npos)
22 return '[' + ip_addr + ']';
23 else
24 return ip_addr;
25}
26} // namespace openvpn
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
std::string quote_ip(const std::string &ip_addr)
Definition quoteip.hpp:19