Skip to content
  • Thomas Haller's avatar
    libnm: add NMSockAddrEndpoint API · 713e879d
    Thomas Haller authored
    NMSockAddrEndpoint is an immutable structure that contains the endpoint
    string of a service. It also includes the (naive) parsing of the host and
    port/service parts.
    
    This will be used for the endpoint of WireGuard's peers. But since endpoints
    are not something specific to WireGuard, give it a general name (and
    purpose) independent from WireGuard.
    
    Essentially, this structure takes a string in a manner that libnm
    understands, and uses it for node and service arguments for
    getaddrinfo().
    
    NMSockAddrEndpoint allows to have endpoints that are not parsable into
    a host and port part. That is useful because our settings need to be
    able to hold invalid values. That is for forward compatibility (server
    sends a new endpoint format) and for better error handling (have
    invalid settings that can be constructed without loss, but fail later
    during the NMSetting:verify() step).
    713e879d