github.com/google/fleetspeak@v0.1.15-0.20240426164851-4f31f62c1aea/cmd/fleetspeak_admin/fleetspeak_admin.go (about) 1 // Copyright 2017 Google Inc. 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 // https://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 // Package main implements a general command line interface which performs 16 // administrative actions on a fleetspeak installation. 17 // 18 // Most functionality is implemented by the cli sub-package. Installations may 19 // want to branch this file to adjust the default admin_addr flag, dial 20 // parameters and similar. 21 package main 22 23 import ( 24 "flag" 25 26 log "github.com/golang/glog" 27 "google.golang.org/grpc" 28 "google.golang.org/grpc/credentials/insecure" 29 30 "github.com/google/fleetspeak/fleetspeak/src/admin/cli" 31 ) 32 33 var adminAddr = flag.String("admin_addr", "localhost:6061", "Address for the admin server.") 34 35 func main() { 36 flag.Parse() 37 38 conn, err := grpc.Dial(*adminAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) 39 if err != nil { 40 log.Exitf("Unable to connect to fleetspeak admin interface [%v]: %v", *adminAddr, err) 41 } 42 43 cli.Execute(conn, flag.Args()...) 44 }