github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/binary_transparency/firmware/cmd/ft_witness/ft_witness.go (about) 1 // Copyright 2020 Google LLC. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // This package is the entrypoint for the Firmware Transparency witness server. 16 package main 17 18 import ( 19 "context" 20 "flag" 21 "time" 22 23 "github.com/golang/glog" 24 "github.com/google/trillian-examples/binary_transparency/firmware/cmd/ft_witness/impl" 25 "github.com/google/trillian-examples/binary_transparency/firmware/internal/crypto" 26 "golang.org/x/mod/sumdb/note" 27 ) 28 29 var ( 30 listenAddr = flag.String("listen", ":8020", "address:port to listen for requests on") 31 wsFile = flag.String("ws_db_file", "", "Path to a file to be used as simple file storage for checkpoint, e.g. /tmp/witness.db") 32 ftLogURL = flag.String("ftlog", "http://localhost:8000", "Base URL of FT Log server") 33 pollInterval = flag.Duration("poll_interval", 5*time.Second, "Duration to wait between polling FT Log for new entries") 34 ) 35 36 func main() { 37 flag.Parse() 38 39 testVerifier, _ := note.NewVerifier(crypto.TestFTPersonalityPub) 40 41 ctx := context.Background() 42 if err := impl.Main(ctx, impl.WitnessOpts{ 43 ListenAddr: *listenAddr, 44 WSFile: *wsFile, 45 FtLogURL: *ftLogURL, 46 FtLogSigVerifier: testVerifier, 47 PollInterval: *pollInterval, 48 }); err != nil { 49 glog.Exit(err.Error()) 50 } 51 }