{"id":19556601,"url":"https://github.com/falcosecurity/client-go","last_synced_at":"2025-03-31T11:00:19.018Z","repository":{"id":44661881,"uuid":"207266874","full_name":"falcosecurity/client-go","owner":"falcosecurity","description":"Go client and SDK for Falco","archived":false,"fork":false,"pushed_at":"2025-03-21T17:34:17.000Z","size":376,"stargazers_count":53,"open_issues_count":1,"forks_count":19,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-22T22:16:31.998Z","etag":null,"topics":["client","falco","go","golang","grpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/falcosecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-09T08:57:21.000Z","updated_at":"2025-03-18T15:34:20.000Z","dependencies_parsed_at":"2023-02-11T00:40:31.259Z","dependency_job_id":"d3408341-9032-4755-8aec-90ba177dc530","html_url":"https://github.com/falcosecurity/client-go","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falcosecurity%2Fclient-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falcosecurity%2Fclient-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falcosecurity%2Fclient-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/falcosecurity%2Fclient-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/falcosecurity","download_url":"https://codeload.github.com/falcosecurity/client-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246457967,"owners_count":20780676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","falco","go","golang","grpc"],"created_at":"2024-11-11T04:38:30.716Z","updated_at":"2025-03-31T11:00:18.991Z","avatar_url":"https://github.com/falcosecurity.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Falco Go Client\n\n[![Falco Ecosystem Repository](https://github.com/falcosecurity/evolution/blob/main/repos/badges/falco-ecosystem-blue.svg)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#ecosystem-scope) [![Incubating](https://img.shields.io/badge/status-incubating-orange?style=for-the-badge)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#incubating)\n\n[![GoDoc](https://godoc.org/github.com/falcosecurity/client-go/pkg/client?status.svg)](https://godoc.org/github.com/falcosecurity/client-go/pkg/client)\n\n\u003e Go client and SDK for Falco\n\nLearn more about the gRPC API by reading [the docs](https://falco.org/docs/grpc/).\n\n## Install\n\n```bash\ngo get -u github.com/falcosecurity/client-go\n```\n\n## Usage\n\n### Network Client creation\n\nIf you are binding the Falco gRPC server to a network socket\nwith mTLS (mutual TLS authentication) you need this one. Please remember that since this is\nenabling mTLS you will need to generate a pair of certificates for this client\nspecifically and provide the CA certificate. If you need something simpler,\ngo for the unix socket.\n\n```go\npackage main\n\nimports(\n    \"context\"\n    \"github.com/falcosecurity/client-go/pkg/client\"\n)\n\nfunc main() {\n    c, err := client.NewForConfig(context.Background(), \u0026client.Config{\n        Hostname:   \"localhost\",\n        Port:       5060,\n        CertFile:   \"/etc/falco/certs/client.crt\",\n        KeyFile:    \"/etc/falco/certs/client.key\",\n        CARootFile: \"/etc/falco/certs/ca.crt\",\n    })\n}\n```\n\n### Unix Socket Client creation\n\nIf you are binding the Falco gRPC server to unix socket, this is what you need.\n\n```go\npackage main\n\nimports(\n    \"context\"\n    \"github.com/falcosecurity/client-go/pkg/client\"\n)\n\nfunc main() {\n    c, err := client.NewForConfig(context.Background(), \u0026client.Config{\n        UnixSocketPath:   \"unix:///run/falco/falco.sock\",\n    })\n}\n```\n\n### Falco outputs API\n\n```go\noutputsClient, err := c.Outputs()\nif err != nil {\n    log.Fatalf(\"unable to obtain an output client: %v\", err)\n}\n\nctx := context.Background()\nfcs, err := outputsClient.Get(ctx, \u0026outputs.Request{})\nif err != nil {\n    log.Fatalf(\"could not subscribe: %v\", err)\n}\n\nfor {\n    res, err := fcs.Recv()\n    if err == io.EOF {\n        break\n    }\n    if err != nil {\n        log.Fatalf(\"error closing stream after EOF: %v\", err)\n    }\n    fmt.Printf(\"rule: %s\\n\", res.Rule)\n}\n```\n\n### Falco version API\n\n```go\n// Set up a connection to the server.\nc, err := client.NewForConfig(context.Background(), \u0026client.Config{\n    Hostname:   \"localhost\",\n    Port:       5060,\n    CertFile:   \"/etc/falco/certs/client.crt\",\n    KeyFile:    \"/etc/falco/certs/client.key\",\n    CARootFile: \"/etc/falco/certs/ca.crt\",\n})\nif err != nil {\n    log.Fatalf(\"unable to create a Falco client: %v\", err)\n}\ndefer c.Close()\nversionClient, err := c.Version()\nif err != nil {\n    log.Fatalf(\"unable to obtain a version client: %v\", err)\n}\n\nctx := context.Background()\nres, err := versionClient.Version(ctx, \u0026version.Request{})\nif err != nil {\n    log.Fatalf(\"error obtaining the Falco version: %v\", err)\n}\nfmt.Printf(\"%v\\n\", res)\n```\n\n## Full Examples\n\n- [Outputs events over mTLS example](examples/output/main.go)\n- [Outputs events over Unix socket example](examples/output_unix_socket/main.go)\n- [Outputs events over mTLS bidirectional example](examples/output_bidi/main.go)\n- [Outputs events over Unix socket bidirectional example](examples/output_unix_socket_bidi/main.go)\n- [Version over mTLS example](examples/version/main.go)\n- [Version over Unix socket example](examples/version_unix_socket/main.go)\n\n## Update protos\n\nPerform the following edits to the Makefile:\n\n1. Update the `PROTOS` array with the destination path of the `.proto` file.\n2. Update the `PROTO_URLS` array with the URL from which to download it.\n3. Update the `PROTO_SHAS` array with the SHA256 sum of the file to download.\n4. Execute the following commands:\n\n```console\nmake clean\nmake protos\n```\n\n## Generate mocks for protos\n\n1. Follow the steps in the `Update protos` section\n2. Execute the following commands:\n\n```console\nmake mocks\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffalcosecurity%2Fclient-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffalcosecurity%2Fclient-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffalcosecurity%2Fclient-go/lists"}