{"action":"created","comment":{"url":"https://api.github.com/repos/insomniacslk/dhcp/pulls/comments/200667318","pull_request_review_id":135029249,"id":200667318,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDY2NzMxOA==","diff_hunk":"@@ -65,14 +65,42 @@ func GetTime() uint32 {\n \treturn uint32((now.Nanoseconds() / 1000000000) % 0xffffffff)\n }\n \n+// NewSolicit creates a new SOLICIT message without populating the CID field.\n+func NewSolicit(modifiers ...Modifier) (DHCPv6, error) {\n+\td, err := NewMessage()\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\td.(*DHCPv6Message).SetMessage(SOLICIT)\n+\toro := new(OptRequestedOption)\n+\toro.SetRequestedOptions([]OptionCode{\n+\t\tDNS_RECURSIVE_NAME_SERVER,\n+\t\tDOMAIN_SEARCH_LIST,\n+\t})\n+\td.AddOption(oro)\n+\td.AddOption(new(OptElapsedTime))\n+\t// FIXME use real values for IA_NA\n+\tiaNa := new(OptIANA)\n+\tiaNa.IaId = [4]byte{0xfa, 0xce, 0xb0, 0x0c}\n+\tiaNa.T1 = 0xe10\n+\tiaNa.T2 = 0x1518\n+\td.AddOption(iaNa)\n+\n+\t// Apply modifiers\n+\tfor _, mod := range modifiers {\n+\t\td = mod(d)\n+\t}\n+\treturn d, nil\n+}\n+\n // NewSolicitForInterface creates a new SOLICIT message with DUID-LLT, using the\n // given network interface's hardware address and current time\n func NewSolicitForInterface(ifname string, modifiers ...Modifier) (DHCPv6, error) {\n-\td, err := NewMessage()\n+\t// We want modifiers to be applied later\n+\td, err := NewSolicit()","path":"dhcpv6/dhcpv6message.go","position":37,"original_position":37,"commit_id":"163b5960903b91a6a0c110555faa78e1e2e07a2e","original_commit_id":"163b5960903b91a6a0c110555faa78e1e2e07a2e","user":{"login":"insomniacslk","id":2356960,"node_id":"MDQ6VXNlcjIzNTY5NjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2356960?v=4","gravatar_id":"","url":"https://api.github.com/users/insomniacslk","html_url":"https://github.com/insomniacslk","followers_url":"https://api.github.com/users/insomniacslk/followers","following_url":"https://api.github.com/users/insomniacslk/following{/other_user}","gists_url":"https://api.github.com/users/insomniacslk/gists{/gist_id}","starred_url":"https://api.github.com/users/insomniacslk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/insomniacslk/subscriptions","organizations_url":"https://api.github.com/users/insomniacslk/orgs","repos_url":"https://api.github.com/users/insomniacslk/repos","events_url":"https://api.github.com/users/insomniacslk/events{/privacy}","received_events_url":"https://api.github.com/users/insomniacslk/received_events","type":"User","site_admin":false},"body":"you can further simplify this function by computing the DUID before, and applying all the modifiers via NewSolicit instead of the loop at the end:\r\n\r\n```\r\n// get the CID for the specified interface\r\niface, err := net.InterfaceByName(iface)\r\nif err ...\r\n\r\nmodifiers = append(modifiers, WithClientID(duid))\r\nd, err := NewSolicit(modifiers)\r\n```","created_at":"2018-07-06T14:18:00Z","updated_at":"2018-07-06T14:18:40Z","html_url":"https://github.com/insomniacslk/dhcp/pull/76#discussion_r200667318","pull_request_url":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/insomniacslk/dhcp/pulls/comments/200667318"},"html":{"href":"https://github.com/insomniacslk/dhcp/pull/76#discussion_r200667318"},"pull_request":{"href":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76","id":199680389,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5NjgwMzg5","html_url":"https://github.com/insomniacslk/dhcp/pull/76","diff_url":"https://github.com/insomniacslk/dhcp/pull/76.diff","patch_url":"https://github.com/insomniacslk/dhcp/pull/76.patch","issue_url":"https://api.github.com/repos/insomniacslk/dhcp/issues/76","number":76,"state":"open","locked":false,"title":"NewSolicit for DHCPv6","user":{"login":"earlgreyz","id":6977403,"node_id":"MDQ6VXNlcjY5Nzc0MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6977403?v=4","gravatar_id":"","url":"https://api.github.com/users/earlgreyz","html_url":"https://github.com/earlgreyz","followers_url":"https://api.github.com/users/earlgreyz/followers","following_url":"https://api.github.com/users/earlgreyz/following{/other_user}","gists_url":"https://api.github.com/users/earlgreyz/gists{/gist_id}","starred_url":"https://api.github.com/users/earlgreyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earlgreyz/subscriptions","organizations_url":"https://api.github.com/users/earlgreyz/orgs","repos_url":"https://api.github.com/users/earlgreyz/repos","events_url":"https://api.github.com/users/earlgreyz/events{/privacy}","received_events_url":"https://api.github.com/users/earlgreyz/received_events","type":"User","site_admin":false},"body":"NewSolicit provides functionality between `NewMessage` and `NewSolicitForInterface`, allowing users to create a `SOLICIT` message without the need to provide an interface. This is crucial for generating fake DHCPv6 messages (ex. for a MAC address not associated with a card on the actual device).","created_at":"2018-07-06T08:36:49Z","updated_at":"2018-07-06T14:18:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2e93fa67fe1b722bea3a72edbd1b2d22a19a559","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76/commits","review_comments_url":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76/comments","review_comment_url":"https://api.github.com/repos/insomniacslk/dhcp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/insomniacslk/dhcp/issues/76/comments","statuses_url":"https://api.github.com/repos/insomniacslk/dhcp/statuses/163b5960903b91a6a0c110555faa78e1e2e07a2e","head":{"label":"earlgreyz:newsolicit","ref":"newsolicit","sha":"163b5960903b91a6a0c110555faa78e1e2e07a2e","user":{"login":"earlgreyz","id":6977403,"node_id":"MDQ6VXNlcjY5Nzc0MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6977403?v=4","gravatar_id":"","url":"https://api.github.com/users/earlgreyz","html_url":"https://github.com/earlgreyz","followers_url":"https://api.github.com/users/earlgreyz/followers","following_url":"https://api.github.com/users/earlgreyz/following{/other_user}","gists_url":"https://api.github.com/users/earlgreyz/gists{/gist_id}","starred_url":"https://api.github.com/users/earlgreyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earlgreyz/subscriptions","organizations_url":"https://api.github.com/users/earlgreyz/orgs","repos_url":"https://api.github.com/users/earlgreyz/repos","events_url":"https://api.github.com/users/earlgreyz/events{/privacy}","received_events_url":"https://api.github.com/users/earlgreyz/received_events","type":"User","site_admin":false},"repo":{"id":139953144,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk5NTMxNDQ=","name":"dhcp","full_name":"earlgreyz/dhcp","owner":{"login":"earlgreyz","id":6977403,"node_id":"MDQ6VXNlcjY5Nzc0MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6977403?v=4","gravatar_id":"","url":"https://api.github.com/users/earlgreyz","html_url":"https://github.com/earlgreyz","followers_url":"https://api.github.com/users/earlgreyz/followers","following_url":"https://api.github.com/users/earlgreyz/following{/other_user}","gists_url":"https://api.github.com/users/earlgreyz/gists{/gist_id}","starred_url":"https://api.github.com/users/earlgreyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earlgreyz/subscriptions","organizations_url":"https://api.github.com/users/earlgreyz/orgs","repos_url":"https://api.github.com/users/earlgreyz/repos","events_url":"https://api.github.com/users/earlgreyz/events{/privacy}","received_events_url":"https://api.github.com/users/earlgreyz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/earlgreyz/dhcp","description":"DHCPv4 and DHCPv6 packet library, client and server written in Go","fork":true,"url":"https://api.github.com/repos/earlgreyz/dhcp","forks_url":"https://api.github.com/repos/earlgreyz/dhcp/forks","keys_url":"https://api.github.com/repos/earlgreyz/dhcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/earlgreyz/dhcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/earlgreyz/dhcp/teams","hooks_url":"https://api.github.com/repos/earlgreyz/dhcp/hooks","issue_events_url":"https://api.github.com/repos/earlgreyz/dhcp/issues/events{/number}","events_url":"https://api.github.com/repos/earlgreyz/dhcp/events","assignees_url":"https://api.github.com/repos/earlgreyz/dhcp/assignees{/user}","branches_url":"https://api.github.com/repos/earlgreyz/dhcp/branches{/branch}","tags_url":"https://api.github.com/repos/earlgreyz/dhcp/tags","blobs_url":"https://api.github.com/repos/earlgreyz/dhcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/earlgreyz/dhcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/earlgreyz/dhcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/earlgreyz/dhcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/earlgreyz/dhcp/statuses/{sha}","languages_url":"https://api.github.com/repos/earlgreyz/dhcp/languages","stargazers_url":"https://api.github.com/repos/earlgreyz/dhcp/stargazers","contributors_url":"https://api.github.com/repos/earlgreyz/dhcp/contributors","subscribers_url":"https://api.github.com/repos/earlgreyz/dhcp/subscribers","subscription_url":"https://api.github.com/repos/earlgreyz/dhcp/subscription","commits_url":"https://api.github.com/repos/earlgreyz/dhcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/earlgreyz/dhcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/earlgreyz/dhcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/earlgreyz/dhcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/earlgreyz/dhcp/contents/{+path}","compare_url":"https://api.github.com/repos/earlgreyz/dhcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/earlgreyz/dhcp/merges","archive_url":"https://api.github.com/repos/earlgreyz/dhcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/earlgreyz/dhcp/downloads","issues_url":"https://api.github.com/repos/earlgreyz/dhcp/issues{/number}","pulls_url":"https://api.github.com/repos/earlgreyz/dhcp/pulls{/number}","milestones_url":"https://api.github.com/repos/earlgreyz/dhcp/milestones{/number}","notifications_url":"https://api.github.com/repos/earlgreyz/dhcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/earlgreyz/dhcp/labels{/name}","releases_url":"https://api.github.com/repos/earlgreyz/dhcp/releases{/id}","deployments_url":"https://api.github.com/repos/earlgreyz/dhcp/deployments","created_at":"2018-07-06T08:03:28Z","updated_at":"2018-07-06T08:03:30Z","pushed_at":"2018-07-06T08:33:08Z","git_url":"git://github.com/earlgreyz/dhcp.git","ssh_url":"git@github.com:earlgreyz/dhcp.git","clone_url":"https://github.com/earlgreyz/dhcp.git","svn_url":"https://github.com/earlgreyz/dhcp","homepage":"","size":247,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"insomniacslk:master","ref":"master","sha":"5062bfae598f68ed7c57b3c14259d1a1ca6476fa","user":{"login":"insomniacslk","id":2356960,"node_id":"MDQ6VXNlcjIzNTY5NjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2356960?v=4","gravatar_id":"","url":"https://api.github.com/users/insomniacslk","html_url":"https://github.com/insomniacslk","followers_url":"https://api.github.com/users/insomniacslk/followers","following_url":"https://api.github.com/users/insomniacslk/following{/other_user}","gists_url":"https://api.github.com/users/insomniacslk/gists{/gist_id}","starred_url":"https://api.github.com/users/insomniacslk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/insomniacslk/subscriptions","organizations_url":"https://api.github.com/users/insomniacslk/orgs","repos_url":"https://api.github.com/users/insomniacslk/repos","events_url":"https://api.github.com/users/insomniacslk/events{/privacy}","received_events_url":"https://api.github.com/users/insomniacslk/received_events","type":"User","site_admin":false},"repo":{"id":112529472,"node_id":"MDEwOlJlcG9zaXRvcnkxMTI1Mjk0NzI=","name":"dhcp","full_name":"insomniacslk/dhcp","owner":{"login":"insomniacslk","id":2356960,"node_id":"MDQ6VXNlcjIzNTY5NjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2356960?v=4","gravatar_id":"","url":"https://api.github.com/users/insomniacslk","html_url":"https://github.com/insomniacslk","followers_url":"https://api.github.com/users/insomniacslk/followers","following_url":"https://api.github.com/users/insomniacslk/following{/other_user}","gists_url":"https://api.github.com/users/insomniacslk/gists{/gist_id}","starred_url":"https://api.github.com/users/insomniacslk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/insomniacslk/subscriptions","organizations_url":"https://api.github.com/users/insomniacslk/orgs","repos_url":"https://api.github.com/users/insomniacslk/repos","events_url":"https://api.github.com/users/insomniacslk/events{/privacy}","received_events_url":"https://api.github.com/users/insomniacslk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/insomniacslk/dhcp","description":"DHCPv4 and DHCPv6 packet library, client and server written in Go","fork":false,"url":"https://api.github.com/repos/insomniacslk/dhcp","forks_url":"https://api.github.com/repos/insomniacslk/dhcp/forks","keys_url":"https://api.github.com/repos/insomniacslk/dhcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/insomniacslk/dhcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/insomniacslk/dhcp/teams","hooks_url":"https://api.github.com/repos/insomniacslk/dhcp/hooks","issue_events_url":"https://api.github.com/repos/insomniacslk/dhcp/issues/events{/number}","events_url":"https://api.github.com/repos/insomniacslk/dhcp/events","assignees_url":"https://api.github.com/repos/insomniacslk/dhcp/assignees{/user}","branches_url":"https://api.github.com/repos/insomniacslk/dhcp/branches{/branch}","tags_url":"https://api.github.com/repos/insomniacslk/dhcp/tags","blobs_url":"https://api.github.com/repos/insomniacslk/dhcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/insomniacslk/dhcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/insomniacslk/dhcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/insomniacslk/dhcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/insomniacslk/dhcp/statuses/{sha}","languages_url":"https://api.github.com/repos/insomniacslk/dhcp/languages","stargazers_url":"https://api.github.com/repos/insomniacslk/dhcp/stargazers","contributors_url":"https://api.github.com/repos/insomniacslk/dhcp/contributors","subscribers_url":"https://api.github.com/repos/insomniacslk/dhcp/subscribers","subscription_url":"https://api.github.com/repos/insomniacslk/dhcp/subscription","commits_url":"https://api.github.com/repos/insomniacslk/dhcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/insomniacslk/dhcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/insomniacslk/dhcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/insomniacslk/dhcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/insomniacslk/dhcp/contents/{+path}","compare_url":"https://api.github.com/repos/insomniacslk/dhcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/insomniacslk/dhcp/merges","archive_url":"https://api.github.com/repos/insomniacslk/dhcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/insomniacslk/dhcp/downloads","issues_url":"https://api.github.com/repos/insomniacslk/dhcp/issues{/number}","pulls_url":"https://api.github.com/repos/insomniacslk/dhcp/pulls{/number}","milestones_url":"https://api.github.com/repos/insomniacslk/dhcp/milestones{/number}","notifications_url":"https://api.github.com/repos/insomniacslk/dhcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/insomniacslk/dhcp/labels{/name}","releases_url":"https://api.github.com/repos/insomniacslk/dhcp/releases{/id}","deployments_url":"https://api.github.com/repos/insomniacslk/dhcp/deployments","created_at":"2017-11-29T21:24:15Z","updated_at":"2018-07-06T11:46:46Z","pushed_at":"2018-07-06T08:36:50Z","git_url":"git://github.com/insomniacslk/dhcp.git","ssh_url":"git@github.com:insomniacslk/dhcp.git","clone_url":"https://github.com/insomniacslk/dhcp.git","svn_url":"https://github.com/insomniacslk/dhcp","homepage":"","size":244,"stargazers_count":18,"watchers_count":18,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":9,"open_issues":7,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76"},"html":{"href":"https://github.com/insomniacslk/dhcp/pull/76"},"issue":{"href":"https://api.github.com/repos/insomniacslk/dhcp/issues/76"},"comments":{"href":"https://api.github.com/repos/insomniacslk/dhcp/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/insomniacslk/dhcp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/insomniacslk/dhcp/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/insomniacslk/dhcp/statuses/163b5960903b91a6a0c110555faa78e1e2e07a2e"}},"author_association":"NONE"}}
{"actor":{"display_login":"insomniacslk"}}