link.go 901 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package conn
  2. import (
  3. "github.com/cnlh/nps/lib/file"
  4. "github.com/cnlh/nps/lib/rate"
  5. "net"
  6. )
  7. type Link struct {
  8. Id int //id
  9. ConnType string //连接类型
  10. Host string //目标
  11. En int //加密
  12. De int //解密
  13. Crypt bool //加密
  14. Conn *Conn
  15. Flow *file.Flow
  16. UdpListener *net.UDPConn
  17. Rate *rate.Rate
  18. UdpRemoteAddr *net.UDPAddr
  19. }
  20. func NewLink(id int, connType string, host string, en, de int, crypt bool, c *Conn, flow *file.Flow, udpListener *net.UDPConn, rate *rate.Rate, UdpRemoteAddr *net.UDPAddr) *Link {
  21. return &Link{
  22. Id: id,
  23. ConnType: connType,
  24. Host: host,
  25. En: en,
  26. De: de,
  27. Crypt: crypt,
  28. Conn: c,
  29. Flow: flow,
  30. UdpListener: udpListener,
  31. Rate: rate,
  32. UdpRemoteAddr: UdpRemoteAddr,
  33. }
  34. }