Documentation ¶
Index ¶
- Constants
- func ConnectAndServe(urlStr, dstURLStr, token string, ttl time.Duration) error
- func FlushWriter(w io.Writer) io.Writer
- func GenerateToken(secret []byte, aud, sub string) (string, error)
- func TokenSubject(secret []byte, aud, token string) (string, error)
- func ValidPath(p string) bool
- type Server
- type Stream
Constants ¶
const ( TokenIssuer = "sendit" TokenAudienceAuth = "auth" TokenAudienceConnect = "connect" )
Token values
Variables ¶
This section is empty.
Functions ¶
func ConnectAndServe ¶
ConnectAndServe will connect to the server at `urlStr` and start serving/routing traffic to the local `addr`. If ttl > 0 then connections in each direction will be refreshed at the specified interval.
func FlushWriter ¶
FlushWriter will call .Flush() immediately after every call to .Write() on the returned io.Writer.
If w does not implement http.Flusher, it panics.
func GenerateToken ¶
GenerateToken will create a new token string with the given audience and subject, signed with the provided secret.
func TokenSubject ¶
TokenSubject will return the subject of a token, after verifying the signature and audience.
Types ¶
type Server ¶
Server is an http.Handler that can multiplex reverse-proxied requests over 2 POST requests from a client.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is a ReadWriteCloser that can have it's read/write pipe replaced safely while actively sending data.
func NewStream ¶
func NewStream() *Stream
NewStream initializes a new stream. SetPipe must be called before data can be transferred.
func (*Stream) Ready ¶
func (s *Stream) Ready() <-chan struct{}
Ready will return a channel indicating when the stream is ready for reading and writing.
func (*Stream) SetPipe ¶
func (s *Stream) SetPipe(r io.ReadCloser, wc io.WriteCloser) error
SetPipe will swap the io.ReadCloser and WriteCloser with the underlying Stream safely.