1use std::net::SocketAddr;
4use crate::connection::Connection;
5
6#[derive(Default, Clone, Debug)]
8pub struct EndpointConfig;
9
10#[derive(Default, Clone, Debug)]
12pub struct ServerConfig;
13
14#[derive(Default, Clone, Debug)]
16pub struct ClientConfig;
17
18pub struct Endpoint {
20 config: EndpointConfig,
21 server_config: Option<ServerConfig>,
22}
23
24pub struct Connecting;
26
27pub struct Incoming;
29
30impl Endpoint {
31 pub fn new(config: EndpointConfig, server_config: Option<ServerConfig>) -> Self {
33 Self { config, server_config }
34 }
35
36 pub async fn bind(_addr: SocketAddr) -> std::io::Result<Self> {
38 Ok(Self::new(EndpointConfig::default(), None))
39 }
40
41 pub async fn connect(&self, _addr: SocketAddr, _server_name: &str) -> std::io::Result<Connecting> {
43 Ok(Connecting)
44 }
45
46 pub async fn accept(&self) -> Option<Incoming> {
48 None
49 }
50}
51
52impl Connecting {
53 pub async fn await_connection(self) -> std::io::Result<Connection> {
55 Ok(Connection::new())
56 }
57}
58
59impl Incoming {
60 pub async fn accept(self) -> std::io::Result<Connection> {
62 Ok(Connection::new())
63 }
64}