congestvpn/UdpVpnServer.hpp

24 lines
663 B
C++

#pragma once
#include <unordered_map>
#include <memory>
#include "UdpVpn.hpp"
class UdpVpnServer: public UdpVpn {
public:
UdpVpnServer(in_port_t port);
UdpVpnServer(const struct in6_addr& bind_addr6, in_port_t port);
protected:
void bind(const struct in6_addr& bind_addr6, in_port_t port);
/** Get the peer associated to this (internal) IP. */
std::shared_ptr<VpnPeer> get_peer_for_ip(const in6_addr& peer_addr);
virtual void receive_from_tun();
virtual void receive_from_udp();
struct sockaddr_in6 _bind_addr;
std::unordered_map<in6_addr, std::shared_ptr<VpnPeer>> _peers;
};