Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
connection_factory.hh
1/*
2 * This file is open source software, licensed to you under the terms
3 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 * distributed with this work for additional information regarding copyright
5 * ownership. You may not use this file except in compliance with the License.
6 *
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
16 * under the License.
17 */
18
19#pragma once
20
21#include <seastar/core/seastar.hh>
22#include <seastar/net/api.hh>
23#include <seastar/net/tls.hh>
24
25namespace seastar::http::experimental {
26
35public:
43 virtual ~connection_factory() {}
44};
45
47 socket_address _addr;
48public:
50 : _addr(std::move(addr))
51 {
52 }
54 return seastar::connect(_addr, {}, transport::TCP);
55 }
56};
57
59 socket_address _addr;
61 sstring _host;
62public:
64 : _addr(std::move(addr))
65 , _creds(std::move(creds))
66 , _host(std::move(host))
67 {
68 }
70 return tls::connect(_creds, _addr, tls::tls_options{.server_name = _host});
71 }
72};
73
74}
Definition: abort_source.hh:59
A representation of a possibly not-yet-computed value.
Definition: future.hh:1197
Definition: connection_factory.hh:46
virtual future< connected_socket > make(abort_source *as) override
Make a connected_socket.
Definition: connection_factory.hh:53
Factory that provides transport for client.
Definition: connection_factory.hh:34
virtual future< connected_socket > make(abort_source *)=0
Make a connected_socket.
Definition: connection_factory.hh:58
virtual future< connected_socket > make(abort_source *as) override
Make a connected_socket.
Definition: connection_factory.hh:69
Definition: shared_ptr.hh:507
Definition: socket_defs.hh:47
future< connected_socket > connect(socket_address sa)
sstring server_name
server name to be used for the SNI TLS extension
Definition: tls.hh:351
future< connected_socket > connect(shared_ptr< certificate_credentials >, socket_address, sstring name)
TLS configuration options.
Definition: tls.hh:347