File: tunnel_endpoint.go

package info (click to toggle)
golang-github-microsoft-dev-tunnels 0.0.25-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,988 kB
  • sloc: cs: 9,969; java: 2,767; javascript: 328; xml: 186; makefile: 5
file content (90 lines) | stat: -rw-r--r-- 4,231 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/TunnelEndpoint.cs

package tunnels

// Base class for tunnel connection parameters.
//
// A tunnel endpoint specifies how and where hosts and clients can connect to a tunnel.
// There is a subclass for each connection mode, each having different connection
// parameters. A tunnel may have multiple endpoints for one host (or multiple hosts), and
// clients can select their preferred endpoint(s) from those depending on network
// environment or client capabilities.
type TunnelEndpoint struct {
	// Gets or sets the ID of this endpoint.
	ID                   string `json:"id,omitempty"`

	// Gets or sets the connection mode of the endpoint.
	//
	// This property is required when creating or updating an endpoint.  The subclass type is
	// also an indication of the connection mode, but this property is necessary to determine
	// the subclass type when deserializing.
	ConnectionMode       TunnelConnectionMode `json:"connectionMode"`

	// Gets or sets the ID of the host that is listening on this endpoint.
	//
	// This property is required when creating or updating an endpoint.  If the host supports
	// multiple connection modes, the host's ID is the same for all the endpoints it
	// supports. However different hosts may simultaneously accept connections at different
	// endpoints for the same tunnel, if enabled in tunnel options.
	HostID               string `json:"hostId"`

	// Gets or sets an array of public keys, which can be used by clients to authenticate the
	// host.
	HostPublicKeys       []string `json:"hostPublicKeys,omitempty"`

	// Gets or sets a string used to format URIs where a web client can connect to ports of
	// the tunnel. The string includes a `TunnelEndpoint.PortToken` that must be replaced
	// with the actual port number.
	PortURIFormat        string `json:"portUriFormat,omitempty"`

	// Gets or sets the URI where a web client can connect to the default port of the tunnel.
	TunnelURI            string `json:"tunnelUri,omitempty"`

	// Gets or sets a string used to format ssh command where ssh client can connect to
	// shared ssh port of the tunnel. The string includes a `TunnelEndpoint.PortToken` that
	// must be replaced with the actual port number.
	PortSshCommandFormat string `json:"portSshCommandFormat,omitempty"`

	// Gets or sets the Ssh command where the Ssh client can connect to the default ssh port
	// of the tunnel.
	TunnelSshCommand     string `json:"tunnelSshCommand,omitempty"`

	// Gets or sets the Ssh gateway public key which should be added to the authorized_keys
	// file so that tunnel service can connect to the shared ssh server.
	SshGatewayPublicKey  string `json:"sshGatewayPublicKey,omitempty"`

	LocalNetworkTunnelEndpoint
	TunnelRelayTunnelEndpoint
}

// Parameters for connecting to a tunnel via a local network connection.
//
// While a direct connection is technically not "tunneling", tunnel hosts may accept
// connections via the local network as an optional more-efficient alternative to a relay.
type LocalNetworkTunnelEndpoint struct {
	// Gets or sets a list of IP endpoints where the host may accept connections.
	//
	// A host may accept connections on multiple IP endpoints simultaneously if there are
	// multiple network interfaces on the host system and/or if the host supports both IPv4
	// and IPv6.  Each item in the list is a URI consisting of a scheme (which gives an
	// indication of the network connection protocol), an IP address (IPv4 or IPv6) and a
	// port number. The URIs do not typically include any paths, because the connection is
	// not normally HTTP-based.
	HostEndpoints []string `json:"hostEndpoints"`
}

// Parameters for connecting to a tunnel via the tunnel service's built-in relay function.
type TunnelRelayTunnelEndpoint struct {
	// Gets or sets the host URI.
	HostRelayURI   string `json:"hostRelayUri,omitempty"`

	// Gets or sets the client URI.
	ClientRelayURI string `json:"clientRelayUri,omitempty"`
}

// Token included in `TunnelEndpoint.PortUriFormat` and
// `TunnelEndpoint.PortSshCommandFormat` that is to be replaced by a specified port
// number.
var PortToken = "{port}"