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

icmp.go 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 ipv4
  5. import "golang.org/x/net/internal/iana"
  6. // An ICMPType represents a type of ICMP message.
  7. type ICMPType int
  8. func (typ ICMPType) String() string {
  9. s, ok := icmpTypes[typ]
  10. if !ok {
  11. return "<nil>"
  12. }
  13. return s
  14. }
  15. // Protocol returns the ICMPv4 protocol number.
  16. func (typ ICMPType) Protocol() int {
  17. return iana.ProtocolICMP
  18. }
  19. // An ICMPFilter represents an ICMP message filter for incoming
  20. // packets. The filter belongs to a packet delivery path on a host and
  21. // it cannot interact with forwarding packets or tunnel-outer packets.
  22. //
  23. // Note: RFC 8200 defines a reasonable role model and it works not
  24. // only for IPv6 but IPv4. A node means a device that implements IP.
  25. // A router means a node that forwards IP packets not explicitly
  26. // addressed to itself, and a host means a node that is not a router.
  27. type ICMPFilter struct {
  28. icmpFilter
  29. }
  30. // Accept accepts incoming ICMP packets including the type field value
  31. // typ.
  32. func (f *ICMPFilter) Accept(typ ICMPType) {
  33. f.accept(typ)
  34. }
  35. // Block blocks incoming ICMP packets including the type field value
  36. // typ.
  37. func (f *ICMPFilter) Block(typ ICMPType) {
  38. f.block(typ)
  39. }
  40. // SetAll sets the filter action to the filter.
  41. func (f *ICMPFilter) SetAll(block bool) {
  42. f.setAll(block)
  43. }
  44. // WillBlock reports whether the ICMP type will be blocked.
  45. func (f *ICMPFilter) WillBlock(typ ICMPType) bool {
  46. return f.willBlock(typ)
  47. }