github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/proxy/proxy.go (about) 1 // Copyright 2021 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package proxy 5 6 // Proxier describes an implemntation of an object that is capable of performing 7 // connection proxying. Typically an implementation will support this interface 8 // and one of the more specific types of proxy's below. Proxy's should be 9 // considered single use with regards to their Start and Stop methods and not 10 // thead safe. 11 type Proxier interface { 12 // Start starts the lifecycle of the proxy. Proxy's should have their start 13 // method called before operating with the proxy. 14 Start() error 15 16 // Stop stops the proxy after a call to Start(). Proxy's should be 17 // considered single use. This call should only ever be made once. 18 Stop() 19 20 // RawConfig is responsible for providing a raw configuration representation 21 // of the proxier for serialising over the wire. 22 RawConfig() (map[string]interface{}, error) 23 24 // Type is the unique key identifying the type of proxying for configuration 25 // purposes. 26 Type() string 27 28 // MarshalYAML implements marshalling method for yaml. 29 MarshalYAML() (interface{}, error) 30 31 // Insecure sets the proxy to be insecure. 32 Insecure() 33 } 34 35 // TunnelProxier describes an implementation that can provide tunneled proxy 36 // services. The interface provides the connection details for connecting to the 37 // proxy 38 type TunnelProxier interface { 39 Proxier 40 41 // Host returns the host string for establishing a tunneled connection. 42 Host() string 43 44 // Port returns the host port to connect to for tunneling connections. 45 Port() string 46 }