Documentation
¶
Index ¶
- Constants
- Variables
- func DeriveClientBearerSecretForClaim(secret [32]byte, clientID [16]byte) [32]byte
- func EncodeClientCredential(cred ClientCredential) (string, error)
- func GenerateClientToken(opts ClientTokenOptions) (string, error)
- func GenerateServerToken(opts ServerTokenOptions) (string, error)
- func GenerateServerTokenFromEnvironment(opts ServerTokenOptions) (string, error)
- func HasClientTokenPrefix(value string) bool
- func HasServerTokenPrefix(value string) bool
- func VerifyClientCredential(secret [32]byte, client ClientCredential, now time.Time) error
- type ClientCredential
- type ClientTokenOptions
- type ForwardSpec
- type Mux
- func (m *Mux) Accept(ctx context.Context) (net.Conn, error)
- func (m *Mux) ActiveStreamCount() int
- func (m *Mux) Close() error
- func (m *Mux) LastPeerActivity() time.Time
- func (m *Mux) OpenStream(ctx context.Context) (net.Conn, error)
- func (m *Mux) Ping(ctx context.Context, timeout time.Duration) error
- func (m *Mux) ReplaceCarrier(carrier io.ReadWriteCloser)
- type MuxConfig
- type MuxRole
- type ServerCredential
- type ServerTokenOptions
Constants ¶
View Source
const ( ServerTokenPrefix = "dts1_" CustomServerTokenPrefix = "dts2_" ClientTokenPrefix = "DT1" CustomClientTokenPrefix = "DT2" TokenVersion = 1 CustomTokenVersion = 2 DefaultServerDays = 180 DefaultClientDays = 90 ProtocolTCP = "tcp" ProtocolUDP = "udp" )
Variables ¶
View Source
var ( ErrExpired = errors.New("derptun token expired") ErrInvalidToken = errors.New("invalid derptun token") )
Functions ¶
func DeriveClientBearerSecretForClaim ¶ added in v0.9.0
func EncodeClientCredential ¶ added in v0.12.0
func EncodeClientCredential(cred ClientCredential) (string, error)
func GenerateClientToken ¶ added in v0.9.0
func GenerateClientToken(opts ClientTokenOptions) (string, error)
func GenerateServerToken ¶ added in v0.9.0
func GenerateServerToken(opts ServerTokenOptions) (string, error)
func GenerateServerTokenFromEnvironment ¶ added in v0.17.0
func GenerateServerTokenFromEnvironment(opts ServerTokenOptions) (string, error)
func HasClientTokenPrefix ¶ added in v0.17.0
func HasServerTokenPrefix ¶ added in v0.17.0
func VerifyClientCredential ¶ added in v0.9.0
func VerifyClientCredential(secret [32]byte, client ClientCredential, now time.Time) error
Types ¶
type ClientCredential ¶ added in v0.9.0
type ClientCredential struct {
Version int `json:"version"`
SessionID [16]byte `json:"session_id"`
ClientID [16]byte `json:"client_id"`
TokenID [16]byte `json:"token_id"`
ClientName string `json:"client_name"`
ExpiresUnix int64 `json:"expires_unix"`
DERPPublic [32]byte `json:"derp_public"`
QUICPublic [32]byte `json:"quic_public"`
BearerSecret [32]byte `json:"bearer_secret"`
ProofMAC string `json:"proof_mac"`
DERPRoute *derpbind.Route
}
func DecodeClientToken ¶ added in v0.9.0
func DecodeClientToken(encoded string, now time.Time) (ClientCredential, error)
func (ClientCredential) SessionToken ¶ added in v0.9.0
func (cred ClientCredential) SessionToken() (sessiontoken.Token, error)
type ClientTokenOptions ¶ added in v0.9.0
type ForwardSpec ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
func (*Mux) ActiveStreamCount ¶ added in v0.9.0
func (*Mux) LastPeerActivity ¶ added in v0.9.0
func (*Mux) ReplaceCarrier ¶
func (m *Mux) ReplaceCarrier(carrier io.ReadWriteCloser)
type ServerCredential ¶ added in v0.9.0
type ServerCredential struct {
Version int `json:"version"`
SessionID [16]byte `json:"session_id"`
ExpiresUnix int64 `json:"expires_unix"`
DERPPrivate string `json:"derp_private"`
QUICPrivate []byte `json:"quic_private"`
SigningSecret [32]byte `json:"signing_secret"`
Forwards []ForwardSpec `json:"forwards,omitempty"`
DERPRoute *derpbind.Route `json:"derp_route,omitempty"`
}
func DecodeServerToken ¶ added in v0.9.0
func DecodeServerToken(encoded string, now time.Time) (ServerCredential, error)
func (ServerCredential) DERPKey ¶ added in v0.9.0
func (cred ServerCredential) DERPKey() (key.NodePrivate, error)
func (ServerCredential) QUICPrivateKey ¶ added in v0.9.0
func (cred ServerCredential) QUICPrivateKey() (ed25519.PrivateKey, error)
func (ServerCredential) SessionToken ¶ added in v0.9.0
func (cred ServerCredential) SessionToken() (sessiontoken.Token, error)
Click to show internal directories.
Click to hide internal directories.