Skip to content

Commit

Permalink
Add type for Redirects.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Hague committed Jul 22, 2016
1 parent ac43d26 commit daf125a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ const (
)

// Context redirects follow options.
type Redirects int

const (
REDIRECTS_FOLLOW = C.GETDNS_REDIRECTS_FOLLOW
REDIRECTS_DO_NOT_FOLLOW = C.GETDNS_REDIRECTS_DO_NOT_FOLLOW
REDIRECTS_FOLLOW Redirects = C.GETDNS_REDIRECTS_FOLLOW
REDIRECTS_DO_NOT_FOLLOW = C.GETDNS_REDIRECTS_DO_NOT_FOLLOW
)

// Context namespace types.
Expand Down
6 changes: 3 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,17 @@ func (c *Context) SetEDNSVersion(newval uint8) error {
return nil
}

func (c *Context) FollowRedirects() (int, error) {
func (c *Context) FollowRedirects() (Redirects, error) {
var val C.getdns_redirects_t
rc := ReturnCode(C.getdns_context_get_follow_redirects(c.ctx, &val))
if rc != RETURN_GOOD {
return 0, &returnCodeError{rc}
}

return int(val), nil
return Redirects(val), nil
}

func (c *Context) SetFollowRedirects(newval int) error {
func (c *Context) SetFollowRedirects(newval Redirects) error {
rc := ReturnCode(C.getdns_context_set_follow_redirects(c.ctx, C.getdns_redirects_t(newval)))
if rc != RETURN_GOOD {
return &returnCodeError{rc}
Expand Down

0 comments on commit daf125a

Please sign in to comment.