interface.go 599 B

1234567891011121314151617181920212223242526
  1. // Copyright (C) 2015 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package nat
  7. import (
  8. "net"
  9. "time"
  10. )
  11. type Protocol string
  12. const (
  13. TCP Protocol = "TCP"
  14. UDP = "UDP"
  15. )
  16. type Device interface {
  17. ID() string
  18. GetLocalIPAddress() net.IP
  19. AddPortMapping(protocol Protocol, internalPort, externalPort int, description string, duration time.Duration) (int, error)
  20. GetExternalIPAddress() (net.IP, error)
  21. }