{"id":18624073,"url":"https://github.com/mitghi/servo","last_synced_at":"2025-11-03T18:30:36.654Z","repository":{"id":106909677,"uuid":"228413670","full_name":"mitghi/servo","owner":"mitghi","description":null,"archived":false,"fork":false,"pushed_at":"2019-12-16T15:10:45.000Z","size":4290,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T05:25:29.249Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mitghi.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-12-16T15:10:07.000Z","updated_at":"2019-12-16T15:10:49.000Z","dependencies_parsed_at":"2023-03-13T14:38:49.399Z","dependency_job_id":null,"html_url":"https://github.com/mitghi/servo","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/mitghi%2Fservo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitghi%2Fservo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitghi%2Fservo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitghi%2Fservo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitghi","download_url":"https://codeload.github.com/mitghi/servo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239418576,"owners_count":19635208,"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":[],"created_at":"2024-11-07T04:27:15.186Z","updated_at":"2025-11-03T18:30:36.621Z","avatar_url":"https://github.com/mitghi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# servo\n\nEmbeddable/Extendable TCP Server.\n\n# Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"os\"\n\t\"os/signal\"\n\t\"syscall\"\n\n\t\"github.com/mitghi/servo\"\n)\n\nvar (\n\tesig   chan os.Signal   // exit signal (SIGINT, SIGKILL)\n\tserver *servo.Server    // server instance\n\tconfig servo.ServerOpts // server config\n\terr    error\n\tok     bool\n)\n\n// connHandler is a deleate function which gets invoked\n// when a new connection to server is established. It is\n// executed in a non-blocking mode by the server.\nfunc connHandler(conn net.Conn) interface{} {\n\tlog.Printf(\"* handling connection(%s) ....\\n\", conn.RemoteAddr().String())\n\tconn.Close()\n\tconn = nil\n\n\treturn nil\n}\n\nfunc main() {\n\tesig = make(chan os.Signal, 1)\n\tsignal.Notify(esig, syscall.SIGINT, syscall.SIGKILL)\n\t// define server configuration\n\tconfig = servo.ServerOpts{\n\t\tOnNewConnection: connHandler, // connection delegate\n\t\tAddr:            \":8080\",     // server address\n\t\tStartDeadline:   2,           // maximum wait for server start\n\t}\n\t// create server instance\n\t// from configurations.\n\tserver, err = servo.NewServerFromConfig(config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// start the server.\n\terr = server.Start()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Println(fmt.Sprintf(\"+ [%s][%s] server started.\", server.SID, config.Addr))\n\t// catch SIGINT or SIGKILL.\n\t\u003c-esig\n\t// stop the server.\n\tok, err = server.Stop()\n\tif !ok || err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Println(fmt.Sprintf(\"+ [%s] server quitted.\", server.SID))\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitghi%2Fservo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitghi%2Fservo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitghi%2Fservo/lists"}