...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package client
16
17 import (
18 "net/url"
19
20 "github.com/go-openapi/runtime"
21 httptransport "github.com/go-openapi/runtime/client"
22 "github.com/go-openapi/strfmt"
23 "github.com/sigstore/timestamp-authority/pkg/generated/client"
24 )
25
26 func GetTimestampClient(timestampServerURL string, opts ...Option) (*client.TimestampAuthority, error) {
27 url, err := url.Parse(timestampServerURL)
28 if err != nil {
29 return nil, err
30 }
31 o := makeOptions(opts...)
32
33 rt := httptransport.New(url.Host, client.DefaultBasePath, []string{url.Scheme})
34
35 rt.Producers["application/timestamp-query"] = runtime.ByteStreamProducer()
36 rt.Producers["application/json"] = runtime.JSONProducer()
37
38 rt.Consumers["application/timestamp-reply"] = runtime.ByteStreamConsumer()
39 rt.Consumers["application/json"] = runtime.JSONConsumer()
40 rt.Consumers["application/pem-certificate-chain"] = runtime.TextConsumer()
41
42 rt.Transport = createRoundTripper(rt.Transport, o)
43
44 registry := strfmt.Default
45 return client.New(rt, registry), nil
46 }
47
View as plain text