naiveproxy/services/network/public/mojom/proxy_resolving_socket.mojom

47 lines
2.2 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
// 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<data_pipe_consumer>? receive_stream,
handle<data_pipe_producer>? send_stream);
};