{"id":19666593,"url":"https://github.com/xaionaro-go/iscdhcp","last_synced_at":"2025-04-28T22:31:48.460Z","repository":{"id":71636413,"uuid":"122324501","full_name":"xaionaro-go/iscDhcp","owner":"xaionaro-go","description":"Go (Golang) ISC DHCP API + config parser/generator","archived":false,"fork":false,"pushed_at":"2018-06-27T18:20:42.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T11:34:21.274Z","etag":null,"topics":["config","configuration","dhcp-server","dhcpd","generator","go","golang","isc","parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xaionaro-go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-02-21T10:54:06.000Z","updated_at":"2025-03-13T15:55:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7ef1de1-0842-486a-87e6-2e3ac6b84013","html_url":"https://github.com/xaionaro-go/iscDhcp","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/xaionaro-go%2FiscDhcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2FiscDhcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2FiscDhcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2FiscDhcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xaionaro-go","download_url":"https://codeload.github.com/xaionaro-go/iscDhcp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397643,"owners_count":21583045,"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":["config","configuration","dhcp-server","dhcpd","generator","go","golang","isc","parser"],"created_at":"2024-11-11T16:28:13.123Z","updated_at":"2025-04-28T22:31:44.894Z","avatar_url":"https://github.com/xaionaro-go.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"= ISC DHCP Server API\n\nThis package controls the process (starts, stops) and the configuration file of `isc-dhcp-server`.\n\nYou can use [github.com/xaionaro-go/iscDhcp/cfg](https://github.com/xaionaro-go/iscDhcp/tree/master/cfg) as just a config parser/generator.\n\nUPD: Seems the parser/generator is useless, because there's another (better) project: [github.com/sayotte/iscdhcp](https://github.com/sayotte/iscdhcp)\n\n```\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"github.com/xaionaro-go/iscDhcp/cfg\"\n\t\"os\"\n)\n\nfunc main() {\n\tcfg := cfg.NewConfig()\n\terr := cfg.LoadFrom(\"/etc/dhcp/dhcpd.conf\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\tjsonEncoder := json.NewEncoder(os.Stderr)\n\tjsonEncoder.SetIndent(\"\", \"  \")\n\tjsonEncoder.Encode(cfg)\n}\n\nresult:\n\n{\n  \"UserDefinedOptionFields\": {\n    \"ms-classless-static-routes\": {\n      \"Code\": 249,\n      \"ValueType\": 1\n    },\n    \"rfc3442-classless-static-routes\": {\n      \"Code\": 121,\n      \"ValueType\": 1\n    }\n  },\n  \"Options\": {\n    \"DefaultLeaseTime\": 600,\n    \"MaxLeaseTime\": 7200,\n    \"Authoritative\": true,\n    \"DomainNameServers\": [\n      \"ns1.example.org\",\n      \"ns2.example.org\"\n    ],\n    \"DomainName\": \"example.org\",\n    \"Range\": {}\n  },\n  \"Subnets\": {\n    \"10.254.239.32\": {\n      \"Network\": \"10.254.239.32\",\n      \"Mask\": \"AAAAAAAAAAAAAP//////4A==\",\n      \"Options\": {\n        \"Range\": {\n          \"Start\": \"10.254.239.40\",\n          \"End\": \"10.254.239.60\"\n        },\n        \"Routers\": [\n          \"rtr-239-32-1.example.org\"\n        ],\n        \"BroadcastAddress\": \"10.254.239.31\"\n      }\n    },\n    \"10.5.5.0\": {\n      \"Network\": \"10.5.5.0\",\n      \"Mask\": \"AAAAAAAAAAAAAP//////4A==\",\n      \"Options\": {\n        \"DefaultLeaseTime\": 600,\n        \"MaxLeaseTime\": 7200,\n        \"DomainNameServers\": [\n          \"ns1.internal.example.org\"\n        ],\n        \"DomainName\": \"internal.example.org\",\n        \"Range\": {\n          \"Start\": \"10.5.5.26\",\n          \"End\": \"10.5.5.30\"\n        },\n        \"Routers\": [\n          \"10.5.5.1\"\n        ],\n        \"BroadcastAddress\": \"10.5.5.31\"\n      }\n    },\n    \"10.55.0.0\": {\n      \"Network\": \"10.55.0.0\",\n      \"Mask\": \"AAAAAAAAAAAAAP//////AA==\",\n      \"Options\": {\n        \"DomainNameServers\": [\n          \"10.55.0.31\"\n        ],\n        \"DomainName\": \"campus.someuniver.edu\",\n        \"Range\": {\n          \"Start\": \"10.55.0.230\",\n          \"End\": \"10.55.0.239\"\n        },\n        \"Routers\": [\n          \"10.55.0.8\"\n        ],\n        \"BroadcastAddress\": \"10.55.0.255\",\n        \"Filename\": \"pxelinux.0\",\n        \"NextServer\": \"10.55.0.12\",\n        \"RootPath\": \"/srv/share/nfs/public\",\n        \"MTU\": 1300,\n        \"Custom\": {\n          \"121\": \"GMCoZAoyAAs=\",\n          \"249\": \"GMCoZAoyAAs=\"\n        }\n      }\n    }\n  }\n}\n\n--- Regenerating the configuration:\n\noption ms-classless-static-routes code 249 = array of integer 8;\noption rfc3442-classless-static-routes code 121 = array of integer 8;\ndefault-lease-time 600;\nmax-lease-time 7200;\nauthoritative;\ndomain-name example.org;\ndomain-name-servers ns1.example.org, ns2.example.org;\n\nsubnet 10.254.239.32 netmask 255.255.255.224 {\n\trange 10.254.239.40 10.254.239.60;\n\toption routers rtr-239-32-1.example.org;\n\toption broadcast-address 10.254.239.31;\n}\n\nsubnet 10.5.5.0 netmask 255.255.255.224 {\n\tdefault-lease-time 600;\n\tmax-lease-time 7200;\n\tdomain-name internal.example.org;\n\tdomain-name-servers ns1.internal.example.org;\n\trange 10.5.5.26 10.5.5.30;\n\toption routers 10.5.5.1;\n\toption broadcast-address 10.5.5.31;\n}\n\nsubnet 10.55.0.0 netmask 255.255.255.0 {\n\tdomain-name campus.someuniver.edu;\n\tdomain-name-servers 10.55.0.31;\n\trange 10.55.0.230 10.55.0.239;\n\toption routers 10.55.0.8;\n\toption broadcast-address 10.55.0.255;\n\tnext-server 10.55.0.12;\n\tfilename \"pxelinux.0\";\n\toption root-path \"/srv/share/nfs/public\";\n\toption interface-mtu 1300;\n\toption rfc3442-classless-static-routes 24, 192, 168, 100, 10, 55, 0, 11;\n\toption ms-classless-static-routes 24, 192, 168, 100, 10, 55, 0, 11;\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaionaro-go%2Fiscdhcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaionaro-go%2Fiscdhcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaionaro-go%2Fiscdhcp/lists"}