{"id":13493072,"url":"https://github.com/koding/kite","last_synced_at":"2025-05-15T00:13:30.418Z","repository":{"id":14326518,"uuid":"17035868","full_name":"koding/kite","owner":"koding","description":"Micro-service framework in Go","archived":false,"fork":false,"pushed_at":"2018-10-28T20:12:37.000Z","size":4238,"stargazers_count":3267,"open_issues_count":34,"forks_count":301,"subscribers_count":134,"default_branch":"master","last_synced_at":"2025-04-13T20:44:31.969Z","etag":null,"topics":["authentication-backend","discovery-service","go","web-framework"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/koding/kite","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koding.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}},"created_at":"2014-02-20T21:14:43.000Z","updated_at":"2025-04-11T00:13:03.000Z","dependencies_parsed_at":"2022-08-07T08:00:07.142Z","dependency_job_id":null,"html_url":"https://github.com/koding/kite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koding","download_url":"https://codeload.github.com/koding/kite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782280,"owners_count":21160716,"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":["authentication-backend","discovery-service","go","web-framework"],"created_at":"2024-07-31T19:01:11.941Z","updated_at":"2025-04-13T20:44:38.071Z","avatar_url":"https://github.com/koding.png","language":"Go","funding_links":[],"categories":["开源类库","Open source library","Service Toolkits","Go","Repositories"],"sub_categories":["微服务","Microservices","Go"],"readme":"Kite Micro-Service Framework\n============================\n\nKite is a framework for developing micro-services in Go.\n\n[![GoDoc](http://img.shields.io/badge/go-documentation-brightgreen.svg?style=flat-square)](https://godoc.org/github.com/koding/kite)\n[![Build Status](http://img.shields.io/travis/koding/kite/master.svg?style=flat-square)](https://travis-ci.org/koding/kite)\n\n![Kite](http://i.imgur.com/iNcltPN.png)\n\n\nKite is both the name of the framework and the micro-service that is written by\nusing this framework.  Basically, Kite is a RPC server as well as a client. It\nconnects to other kites and peers to communicate with each other. They can\ndiscover other kites using a service called Kontrol, and communicate with them \nbidirectionaly. The communication protocol uses a WebSocket (or XHR) as transport \nin order to allow web applications to connect directly to kites.\n\nKites can talk with each other by sending\n[dnode](https://github.com/substack/dnode-protocol/blob/master/doc/protocol.markdown)\nmessages over a socket session.  If the client knows the URL of the server kite it\ncan connect to it directly.  If the URL is not known, client can ask for it\nfrom Kontrol (Service Discovery).\n\nFor more info checkout the blog post at GopherAcademy which explains Kite in more detail: http://blog.gopheracademy.com/birthday-bash-2014/kite-microservice-library/\n\nInstall and Usage\n-----------------\n\nInstall the package with:\n\n```bash\ngo get github.com/koding/kite\n```\n\nImport it with:\n\n```go\nimport \"github.com/koding/kite\"\n```\n\nand use `kite` as the package name inside the code.\n\nWhat is *Kontrol*?\n------------------\n\nKontrol is the service registry and authentication service used by Kites.  It\nis itself a kite too.\n\nWhen a kite starts to run, it can registers itself to Kontrol with the\n`Register()` method if wished.  That enables others to find it by querying\nKontrol. There is also a Proxy Kite for giving public URLs to registered\nkites.\n\nQuery has 7 fields:\n\n    /\u003cusername\u003e/\u003cenvironment\u003e/\u003cname\u003e/\u003cversion\u003e/\u003cregion\u003e/\u003chostname\u003e/\u003cid\u003e\n\n* You must at least give the username.\n* The order of the fields is from general to specific.\n* Query cannot contains empty parts between fields.\n\nInstalling *Kontrol*\n------------------\n\nInstall Kontrol:\n\n```\ngo get github.com/koding/kite/kontrol/kontrol\n```\n\nGenerate keys for the Kite key:\n\n```\nopenssl genrsa -out key.pem 2048\nopenssl rsa -in key.pem -pubout \u003e key_pub.pem\n```\n\nSet environment variables:\n\n```\nKONTROL_PORT=6000\nKONTROL_USERNAME=\"kontrol\"\nKONTROL_STORAGE=\"etcd\"\nKONTROL_KONTROLURL=\"http://127.0.0.1:6000/kite\"\nKONTROL_PUBLICKEYFILE=\"certs/key_pub.pem\"\nKONTROL_PRIVATEKEYFILE=\"certs/key.pem\"\n```\n\nGenerate initial Kite key:\n\n```\n./bin/kontrol -initial\n```\n\nHow can I use kites from a browser?\n---------------------------------\n\nA browser can also be a Kite. It has it's own methods (\"log\" for logging a\nmessage to the console, \"alert\" for displaying alert to the user, etc.). A\nconnected kite can call methods defined on the webpage.\n\nSee [kite.js library](https://github.com/koding/kite.js) for more information.\n\nHow can I write a new kite?\n---------------------------\n\n* Import `kite` package.\n* Create a new instance with `kite.New()`.\n* Add your method handlers with `k.HandleFunc()` or `k.Handle()`.\n* Call `k.Run()`\n\nBelow you can find an example, a math kite which calculates the square of a\nreceived number:\n\n```go\npackage main\n\nimport \"github.com/koding/kite\"\n\nfunc main() {\n\t// Create a kite\n\tk := kite.New(\"math\", \"1.0.0\")\n\n\t// Add our handler method with the name \"square\"\n\tk.HandleFunc(\"square\", func(r *kite.Request) (interface{}, error) {\n\t\ta := r.Args.One().MustFloat64()\n\t\tresult := a * a    // calculate the square\n\t\treturn result, nil // send back the result\n\t}).DisableAuthentication()\n\n\t// Attach to a server with port 3636 and run it\n\tk.Config.Port = 3636\n\tk.Run()\n}\n```\n\nNow let's connect to it and send a `4` as an argument.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/koding/kite\"\n)\n\nfunc main() {\n\tk := kite.New(\"exp2\", \"1.0.0\")\n\n\t// Connect to our math kite\n\tmathWorker := k.NewClient(\"http://localhost:3636/kite\")\n\tmathWorker.Dial()\n\n\tresponse, _ := mathWorker.Tell(\"square\", 4) // call \"square\" method with argument 4\n\tfmt.Println(\"result:\", response.MustFloat64())\n}\n```\n\nCheck out the [examples](https://github.com/koding/kite/tree/master/examples)\nfolder for more examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoding%2Fkite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoding%2Fkite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoding%2Fkite/lists"}