@@ -37,6 +37,7 @@ import (
3737 "flag"
3838 "fmt"
3939 "os"
40+ "time"
4041
4142 "github.com/golang/glog"
4243 "github.com/golang/protobuf/ptypes"
5960 signatureAlgorithm = flag .String ("signature_algorithm" , sigpb .DigitallySigned_RSA .String (), "Signature algorithm of the new tree" )
6061 displayName = flag .String ("display_name" , "" , "Display name of the new tree" )
6162 description = flag .String ("description" , "" , "Description of the new tree" )
63+ maxRootDuration = flag .Duration ("max_root_duration" , 0 , "Interval after which a new signed root is produced despite no submissions; zero means never" )
6264
6365 privateKeyFormat = flag .String ("private_key_format" , "PrivateKey" , "Type of private key to be used" )
6466 pemKeyPath = flag .String ("pem_key_path" , "" , "Path to the private key PEM file" )
7274type createOpts struct {
7375 addr string
7476 treeState , treeType , hashStrategy , hashAlgorithm , sigAlgorithm , displayName , description string
77+ maxRootDuration time.Duration
7578 privateKeyType , pemKeyPath , pemKeyPass string
7679}
7780
@@ -130,14 +133,15 @@ func newRequest(opts *createOpts) (*trillian.CreateTreeRequest, error) {
130133 }
131134
132135 tree := & trillian.Tree {
133- TreeState : trillian .TreeState (ts ),
134- TreeType : trillian .TreeType (tt ),
135- HashStrategy : trillian .HashStrategy (hs ),
136- HashAlgorithm : sigpb .DigitallySigned_HashAlgorithm (ha ),
137- SignatureAlgorithm : sigpb .DigitallySigned_SignatureAlgorithm (sa ),
138- DisplayName : opts .displayName ,
139- Description : opts .description ,
140- PrivateKey : pk ,
136+ TreeState : trillian .TreeState (ts ),
137+ TreeType : trillian .TreeType (tt ),
138+ HashStrategy : trillian .HashStrategy (hs ),
139+ HashAlgorithm : sigpb .DigitallySigned_HashAlgorithm (ha ),
140+ SignatureAlgorithm : sigpb .DigitallySigned_SignatureAlgorithm (sa ),
141+ DisplayName : opts .displayName ,
142+ Description : opts .description ,
143+ PrivateKey : pk ,
144+ MaxRootDurationMillis : opts .maxRootDuration .Nanoseconds () / int64 (time .Millisecond ),
141145 }
142146 return & trillian.CreateTreeRequest {Tree : tree }, nil
143147}
@@ -177,17 +181,18 @@ func newPK(opts *createOpts) (*any.Any, error) {
177181
178182func newOptsFromFlags () * createOpts {
179183 return & createOpts {
180- addr : * adminServerAddr ,
181- treeState : * treeState ,
182- treeType : * treeType ,
183- hashStrategy : * hashStrategy ,
184- hashAlgorithm : * hashAlgorithm ,
185- sigAlgorithm : * signatureAlgorithm ,
186- displayName : * displayName ,
187- description : * description ,
188- privateKeyType : * privateKeyFormat ,
189- pemKeyPath : * pemKeyPath ,
190- pemKeyPass : * pemKeyPassword ,
184+ addr : * adminServerAddr ,
185+ treeState : * treeState ,
186+ treeType : * treeType ,
187+ hashStrategy : * hashStrategy ,
188+ hashAlgorithm : * hashAlgorithm ,
189+ sigAlgorithm : * signatureAlgorithm ,
190+ displayName : * displayName ,
191+ description : * description ,
192+ maxRootDuration : * maxRootDuration ,
193+ privateKeyType : * privateKeyFormat ,
194+ pemKeyPath : * pemKeyPath ,
195+ pemKeyPass : * pemKeyPassword ,
191196 }
192197}
193198
0 commit comments