// GetToken attempts to get a token for the given uri.
//
// This function first attempts to load a service token for the requested URI,
// then attempts to load a user JWT using cloudflared if no service token was
// found.
//
// The writer argument is used to redirect os.Stderr from the subprocess (if
// one is spawned). If you want to silence the output from os.Stderr, use
// ioutil.Discard as the writer. If the writer is nil, it is implicitly
// converted to ioutil.Discard.
GetToken attempts to get a token for the given uri.

This function first attempts to load a service token for the requested URI,
then attempts to load a user JWT using cloudflared if no service token was
found.

The writer argument is used to redirect os.Stderr from the subprocess (if
one is spawned). If you want to silence the output from os.Stderr, use
ioutil.Discard as the writer. If the writer is nil, it is implicitly
converted to ioutil.Discard.
// GetToken attempts to get a token for the given uri . // // This function first attempts to load a service token for the requested URI // then attempts to load a user JWT using cloudflared if no service token was // found . // // The writer argument is used to redirect os . Stderr from the subprocess ( if // one is spawned ) . If you want to silence the output from os . Stderr use // ioutil . Discard as the writer . If the writer is nil it is implicitly // converted to ioutil . Discard .
func GetToken(ctx context.Context, uri *url.URL, servicetokendir string,
	usecloudflared bool, w io.Writer) (Token, error) {
	if servicetokendir != "" {
		token, err := FindServiceToken(servicetokendir, uri.Host)
		if err == nil && token != nil {
			return token, nil
		}
	}
	return FindUserToken(ctx, uri, usecloudflared, w)
}
func GetToken ( ctx context . Context , uri * url . URL , servicetokendir string , usecloudflared bool , w io . Writer ) ( Token , error ) { if servicetokendir != " " { token , err := FindServiceToken ( servicetokendir , uri . Host ) if err == nil && token != nil { return token , nil } } return FindUserToken ( ctx , uri , usecloudflared , w ) }
GetToken attempts to get a token for the given uri.
GetToken attempts to get a token for the given uri .
// Attempt to load a service token // Attempt to get the user token