The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

genericopt.go 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package ipv6
  5. import "syscall"
  6. // TrafficClass returns the traffic class field value for outgoing
  7. // packets.
  8. func (c *genericOpt) TrafficClass() (int, error) {
  9. if !c.ok() {
  10. return 0, syscall.EINVAL
  11. }
  12. so, ok := sockOpts[ssoTrafficClass]
  13. if !ok {
  14. return 0, errOpNoSupport
  15. }
  16. return so.GetInt(c.Conn)
  17. }
  18. // SetTrafficClass sets the traffic class field value for future
  19. // outgoing packets.
  20. func (c *genericOpt) SetTrafficClass(tclass int) error {
  21. if !c.ok() {
  22. return syscall.EINVAL
  23. }
  24. so, ok := sockOpts[ssoTrafficClass]
  25. if !ok {
  26. return errOpNoSupport
  27. }
  28. return so.SetInt(c.Conn, tclass)
  29. }
  30. // HopLimit returns the hop limit field value for outgoing packets.
  31. func (c *genericOpt) HopLimit() (int, error) {
  32. if !c.ok() {
  33. return 0, syscall.EINVAL
  34. }
  35. so, ok := sockOpts[ssoHopLimit]
  36. if !ok {
  37. return 0, errOpNoSupport
  38. }
  39. return so.GetInt(c.Conn)
  40. }
  41. // SetHopLimit sets the hop limit field value for future outgoing
  42. // packets.
  43. func (c *genericOpt) SetHopLimit(hoplim int) error {
  44. if !c.ok() {
  45. return syscall.EINVAL
  46. }
  47. so, ok := sockOpts[ssoHopLimit]
  48. if !ok {
  49. return errOpNoSupport
  50. }
  51. return so.SetInt(c.Conn, hoplim)
  52. }