1- // Copyright © by Jeff Foley 2017-2025 . All rights reserved.
1+ // Copyright © by Jeff Foley 2017-2026 . All rights reserved.
22// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33// SPDX-License-Identifier: Apache-2.0
44
@@ -12,7 +12,7 @@ import (
1212 "path"
1313 "time"
1414
15- amasshttp "github.com/owasp-amass/amass/v5/internal/net/http "
15+ client "github.com/owasp-amass/amass/v5/engine/api/client/v1 "
1616)
1717
1818func main () {
@@ -27,24 +27,24 @@ func main() {
2727 flag .BoolVar (& help1 , "h" , false , "Show the program usage message" )
2828 flag .BoolVar (& help2 , "help" , false , "Show the program usage message" )
2929 flag .StringVar (& hostname , "host" , "" , "Hostname or IP address of the Amass Engine" )
30- //flag.BoolVar(&version, "version", false, "Print the version number of this Amass binary")
3130 flag .Parse ()
3231
3332 if (help1 || help2 ) || hostname == "" {
3433 fmt .Fprintf (os .Stderr , "Usage: %s %s\n \n " , path .Base (os .Args [0 ]), "--host HOSTNAME" )
3534 flag .PrintDefaults ()
3635 return
3736 }
38- /*if version {
39- fmt.Fprintf(color.Error, "%s\n", format.Version)
40- return
41- }*/
4237
43- ctx , cancel := context .WithTimeout (context .Background (), 3 * time .Second )
38+ c , err := client .NewClient ("http://" + hostname + ":4000" )
39+ if err != nil {
40+ os .Exit (1 )
41+ }
42+ defer c .Close ()
43+
44+ ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Second )
4445 defer cancel ()
4546
46- u := "http://" + hostname + ":4000/graphql"
47- if _ , err := amasshttp .RequestWebPage (ctx , & amasshttp.Request {URL : u }); err != nil {
47+ if ! c .HealthCheck (ctx ) {
4848 // a failure to respond indicates that the server is not yet available
4949 os .Exit (1 )
5050 }
0 commit comments