tracer.go
func (t *BTTracer) ConfigurePut(endpoint, token string, options PutOptions) error {
	if endpoint == "" || token == "" {
		return errors.New("Endpoint must be non-empty")
	}

	url, err := url.Parse(endpoint)
	if err != nil {
		return err
	}

	// Endpoints without the scheme prefix (or at the very least a '//`
	// prefix) are interpreted as remote server paths. Handle the
	// (unlikely) case of an unspecified scheme. We won't allow other
	// cases, like a port specified without a scheme, though, as per
	// RFC 3986.
	if url.Host == "" {
		if url.Path == "" {
			return errors.New("invalid URL specification: host " +
				"or path must be non-empty")
		}

		url.Host = url.Path
	}

	if url.Scheme == "" {
		url.Scheme = defaultCoronerScheme
	}

	if strings.IndexAny(url.Host, ":") == -1 {
		url.Host += ":" + defaultCoronerPort
	}

	url.Path = "post"
	url.RawQuery = fmt.Sprintf("token=%s", token)

	t.put.endpoint = url.String()
	t.put.options = options

	t.Logf(LogDebug, "Put enabled (endpoint: %s, unlink: %v)\n",
		t.put.endpoint,
		t.put.options.Unlink)

	return nil
}
func (t *BTTracer) ConfigurePut(endpoint, token string, options PutOptions) error {
	if endpoint == "" || token == "" {
		return errors.New("Endpoint must be non-empty")
	}

	url, err := url.Parse(endpoint)
	if err != nil {
		return err
	}

	// Endpoints without the scheme prefix (or at the very least a '//`
	// prefix) are interpreted as remote server paths. Handle the
	// (unlikely) case of an unspecified scheme. We won't allow other
	// cases, like a port specified without a scheme, though, as per
	// RFC 3986.
	if url.Host == "" {
		if url.Path == "" {
			return errors.New("invalid URL specification: host " +
				"or path must be non-empty")
		}

		url.Host = url.Path
	}

	if url.Scheme == "" {
		url.Scheme = defaultCoronerScheme
	}

	if strings.IndexAny(url.Host, ":") == -1 {
		url.Host += ":" + defaultCoronerPort
	}

	url.Path = "post"
	url.RawQuery = fmt.Sprintf("token=%s", token)

	t.put.endpoint = url.String()
	t.put.options = options

	t.Logf(LogDebug, "Put enabled (endpoint: %s, unlink: %v)\n",
		t.put.endpoint,
		t.put.options.Unlink)

	return nil
}
func ( t * BTTracer ) ConfigurePut ( endpoint , token string , options PutOptions ) error { if endpoint == " " || token == " " { return errors . New ( " " ) } url , err := url . Parse ( endpoint ) if err != nil { return err } // Endpoints without the scheme prefix (or at the very least a '//` // prefix) are interpreted as remote server paths. Handle the // (unlikely) case of an unspecified scheme. We won't allow other // cases, like a port specified without a scheme, though, as per // RFC 3986. if url . Host == " " { if url . Path == " " { return errors . New ( " " + " " ) } url . Host = url . Path } if url . Scheme == " " { url . Scheme = defaultCoronerScheme } if strings . IndexAny ( url . Host , " " ) == - 1 { url . Host += " " + defaultCoronerPort } url . Path = " " url . RawQuery = fmt . Sprintf ( " " , token ) t . put . endpoint = url . String ( ) t . put . options = options t . Logf ( LogDebug , " \n " , t . put . endpoint , t . put . options . Unlink ) return nil }
// Configures the uploading of a generated snapshot file to a remote Backtrace
// coronerd object store.
//
// Uploads use simple one-shot semantics and won't retry on failures. For
// more robust snapshot uploading and directory monitoring, consider using
// coroner daemon, as described at
// https://documentation.backtrace.io/snapshot/#daemon.
//
// endpoint: The URL of the server. It must be a valid HTTP endpoint as
// according to url.Parse() (which is based on RFC 3986). The default scheme
// and port are https and 6098, respectively, and are used if left unspecified.
//
// token: The hash associated with the coronerd project to which this
// application belongs; see
// https://documentation.backtrace.io/coronerd_setup/#authentication-tokens
// for more details.
//
// options: Modifies behavior of the Put action; see PutOptions documentation
// for more details.
Configures the uploading of a generated snapshot file to a remote Backtrace coronerd object store . Uploads use simple one - shot semantics and won t retry on failures . For more robust snapshot uploading and directory monitoring consider using coroner daemon as described at https : // documentation . backtrace . io / snapshot / #daemon . endpoint : The URL of the server . It must be a valid HTTP endpoint as according to url . Parse () ( which is based on RFC 3986 ) . The default scheme and port are https and 6098 respectively and are used if left unspecified . token : The hash associated with the coronerd project to which this application belongs ; see https : // documentation . backtrace . io / coronerd_setup / #authentication - tokens for more details . options : Modifies behavior of the Put action ; see PutOptions documentation for more details .