Documentation ¶
Overview ¶
Package presigner implements AWS v4 presigner wrapper for AWS IoT websocket connection. This presigner wrapper works around the AWS IoT websocket's problem in presigned URL with SESSION_TOKEN.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Presigner ¶
type Presigner struct {
// contains filtered or unexported fields
}
Presigner is an AWS v4 signer wrapper for AWS IoT.
func (*Presigner) PresignWss ¶
func (a *Presigner) PresignWss(ctx context.Context, endpoint string, expire time.Duration, from time.Time) (string, error)
PresignWss generates presigned AWS IoT websocket URL for specified endpoint hostname.
func (*Presigner) PresignWssNow ¶
PresignWssNow generates presigned AWS IoT websocket URL for specified endpoint hostname. The URL is valid from now until 24 hours later which is the limit of AWS IoT Websocket connection.
Example ¶
ctx := context.TODO() cfg, err := config.LoadDefaultConfig(ctx) if err != nil { panic(err) } ps := New(&cfg) wssURL, err := ps.PresignWssNow(ctx, "test.iot.world-1.amazonaws.com") if err != nil { panic(err) } fmt.Printf("%s\n", wssURL)
Output:
Click to show internal directories.
Click to hide internal directories.