1 package sessions 2 3 import "time" 4 5 type optFunc func(*store) 6 7 // Name sets the cookie name 8 func Name(name string) optFunc { 9 return func(s *store) { 10 s.cookie.Name = name 11 } 12 } 13 14 // Domain sets the optional domain for the cookie 15 func Domain(domain string) optFunc { 16 return func(s *store) { 17 s.cookie.Domain = domain 18 } 19 } 20 21 // Path sets the optional path for the cookie 22 func Path(path string) optFunc { 23 return func(s *store) { 24 s.cookie.Path = path 25 } 26 } 27 28 // HTTPOnly sets the httponly flag on the cookie 29 func HTTPOnly() optFunc { 30 return func(s *store) { 31 s.cookie.HttpOnly = true 32 } 33 } 34 35 // Secure sets the secure flag on the cookie 36 func Secure() optFunc { 37 return func(s *store) { 38 s.cookie.Secure = true 39 } 40 } 41 42 // Expiry sets a maximum time that a cookie and authenticated message are valid 43 // for 44 func Expiry(d time.Duration) optFunc { 45 return func(s *store) { 46 s.expires = d 47 } 48 }