// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module network.mojom; import "net/interfaces/ip_endpoint.mojom"; import "services/network/public/mojom/mutable_network_traffic_annotation_tag.mojom"; import "url/mojom/url.mojom"; // Represents a connected socket that respects system's proxy settings. Writes // and Reads are through the data pipes supplied upon construction. Consumer // can close the socket by destroying the interface pointer. interface ProxyResolvingSocket{ // TODO(xunjieli): Add methods to configure the socket connection and allow // consumers to specify whether they want to disconnect or return the socket // to socket pools. }; // Factory interface for creating ProxyResolvingSocket. Each factory instance // has separate socket pools from the NetworkContext which created the // factory instance. interface ProxyResolvingSocketFactory { // Creates a socket connected to |url|. This connection might be done through // proxies if any is set in system's proxy settings. If |use_tls|, a TLS // connection will be established on top of a TCP connection. On success, // |result| is net::OK. Caller is to use |send_stream| to send data and // |receive_stream| to receive data over the connection. On failure, |result| // is a network error code. |local_addr| contains the local address of the // socket. |peer_addr| contains the peer address. If socket is connected to a // proxy, |peer_addr| will be null. // // If socket is closed before the callback can be completed, the callback will // be invoked with net::ERR_ABORTED. // // Any sockets that are created but are yet to be destroyed will be destroyed // when the implementation of this factory goes away. CreateProxyResolvingSocket(url.mojom.Url url, bool use_tls, MutableNetworkTrafficAnnotationTag traffic_annotation, ProxyResolvingSocket& socket) => (int32 result, net.interfaces.IPEndPoint? local_addr, net.interfaces.IPEndPoint? peer_addr, handle? receive_stream, handle? send_stream); };