SSL_GET_PEER_ADDR(3SSL)

NAME
SSL_get_peer_addr - obtain the peer address of a QUIC connection

SYNOPSIS
 #include <openssl/ssl.h>

 int SSL_get_peer_addr(SSL *ssl, BIO_ADDR *peer_addr);

DESCRIPTION
SSL_get_peer_addr() retrieves the peer address of a QUIC connection and stores it into the BIO_ADDR structure pointed to by peer_addr. The caller must supply a valid BIO_ADDR object which will be filled in on success.

This function is only meaningful when called on an SSL object which represents a QUIC connection or stream. It is not valid for non-QUIC SSL objects.

NOTES
The peer address identifies the remote endpoint of a QUIC connection. For UDP sockets used by QUIC, the kernel does not maintain a connected peer in the same sense as for TCP. Instead, the peer address is tracked in the QUIC connection state. SSL_get_peer_addr() provides a way to obtain this address information from OpenSSL.

The BIO_ADDR type is an OpenSSL abstraction which can represent both IPv4 and IPv6 socket addresses. Applications can get the address family via the BIO_ADDR(3) API.

RETURN VALUES
SSL_get_peer_addr() returns 1 on success. On failure, or if called on an SSL object which is not a QUIC SSL object, 0 is returned and peer_addr is left unchanged.

SEE ALSO
SSL_accept_connection(3), SSL_accept_stream(3), BIO_ADDR(3)

HISTORY
This function was added in OpenSSL 4.0.

COPYRIGHT
Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.