4#if defined(USE_API) && defined(USE_API_OUTGOING_CONNECTION)
7#error "api outgoing_connection needs noise encryption so the peer is verified by key"
26static constexpr size_t TARGET_ADDR_LEN = 16;
32 uint8_t
addr[TARGET_ADDR_LEN];
85#ifndef API_OUTGOING_CONNECTION_HOST
92 void format_target_(std::span<char, socket::SOCKADDR_STR_LEN> buf)
const;
99#ifndef API_OUTGOING_CONNECTION_HOST
110#ifndef API_OUTGOING_CONNECTION_HOST
Dials out when no dial-back target client is connected.
ESPPreferenceObject target_pref_
void poll_connect_(APIServer *server, uint32_t now)
static constexpr uint32_t CONNECT_TIMEOUT_MS
void handoff_(APIServer *server, uint32_t now)
static constexpr uint32_t PRECONDITION_RETRY_MS
socklen_t target_sockaddr_(struct sockaddr_storage *addr) const
Fill addr with the target and return its length, or 0 when there is none.
void format_target_(std::span< char, socket::SOCKADDR_STR_LEN > buf) const
Format the remembered target for a log line; empty when there is none.
void on_client_removed(APIConnection *conn, bool was_authenticated)
Clears the dialed-connection gate; dying unauthenticated escalates the backoff.
void schedule_wait_(uint32_t now, uint32_t wait)
static constexpr uint32_t BOOT_WAIT_MS
void schedule_retry_(uint32_t now)
static constexpr uint32_t CONNECT_POLL_INTERVAL_MS
SavedOutgoingTarget saved_
static constexpr uint32_t BACKOFF_MAX_MS
static constexpr uint32_t BACKOFF_MIN_MS
static constexpr uint32_t IDLE_WAIT_MS
static constexpr uint32_t NETWORK_RETRY_MS
void on_target_client(APIConnection *conn)
A key-verified client declared itself a dial-back target; last one wins.
std::unique_ptr< socket::Socket > dial_socket_
void try_dial_(APIServer *server, uint32_t now)
APIConnection * dialed_conn_
struct esphome::api::SavedOutgoingTarget PACKED
ESPPreferences * global_preferences
bool sync()
Commit pending writes to flash.
uint8_t addr[TARGET_ADDR_LEN]