gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/tcpip/BUILD (about) 1 load("//tools:defs.bzl", "go_library", "go_test") 2 load("//tools:deps.bzl", "deps_test") 3 load("//tools/go_generics:defs.bzl", "go_template_instance") 4 5 package( 6 default_applicable_licenses = ["//:license"], 7 licenses = ["notice"], 8 ) 9 10 go_template_instance( 11 name = "sock_err_list", 12 out = "sock_err_list.go", 13 package = "tcpip", 14 prefix = "sockError", 15 template = "//pkg/ilist:generic_list", 16 types = { 17 "Element": "*SockError", 18 "Linker": "*SockError", 19 }, 20 ) 21 22 go_library( 23 name = "tcpip", 24 srcs = [ 25 "errors.go", 26 "sock_err_list.go", 27 "socketops.go", 28 "stdclock.go", 29 "stdclock_state.go", 30 "tcpip.go", 31 "tcpip_state.go", 32 "timer.go", 33 ], 34 visibility = ["//visibility:public"], 35 deps = [ 36 "//pkg/atomicbitops", 37 "//pkg/buffer", 38 "//pkg/sync", 39 "//pkg/waiter", 40 ], 41 ) 42 43 deps_test( 44 name = "netstack_deps_test", 45 # NOTE: Try not to let allowed or allowed_prefixes to grow large. 46 # 47 # Netstack is intentionally somewhat separate from the rest of gVisor; it is 48 # intended to be usable separately as a library. Therefore we limit its 49 # dependencies to a small set of packages. If you're adding dependencies, 50 # consider whether netstack should really depend on them. 51 allowed = [ 52 # gVisor deps. 53 "//pkg/atomicbitops", 54 "//pkg/bits", 55 "//pkg/context", 56 "//pkg/buffer", 57 "//pkg/cpuid", 58 "//pkg/gohacks", 59 "//pkg/goid", 60 "//pkg/ilist", 61 "//pkg/linewriter", 62 "//pkg/log", 63 "//pkg/pool", 64 "//pkg/rand", 65 "//pkg/refs", 66 "//pkg/sleep", 67 "//pkg/state", 68 "//pkg/state/wire", 69 "//pkg/sync", 70 "//pkg/sync/locking", 71 "//pkg/waiter", 72 "//pkg/xdp", 73 74 # Other deps. 75 "@com_github_google_btree//:go_default_library", 76 "@org_golang_x_sys//cpu:go_default_library", 77 "@org_golang_x_sys//unix:go_default_library", 78 "@org_golang_x_time//rate:go_default_library", 79 ], 80 allowed_prefixes = [ 81 "//pkg/tcpip", 82 "@org_golang_x_sys//internal/unsafeheader", 83 ], 84 targets = [ 85 "//pkg/tcpip", 86 "//pkg/tcpip/adapters/gonet", 87 "//pkg/tcpip/link/channel", 88 "//pkg/tcpip/header", 89 "//pkg/tcpip/link/fdbased", 90 "//pkg/tcpip/link/loopback", 91 "//pkg/tcpip/link/qdisc/fifo", 92 "//pkg/tcpip/link/sniffer", 93 "//pkg/tcpip/network/arp", 94 "//pkg/tcpip/network/ipv4", 95 "//pkg/tcpip/network/ipv6", 96 "//pkg/tcpip/stack", 97 "//pkg/tcpip/transport/icmp", 98 "//pkg/tcpip/transport/raw", 99 "//pkg/tcpip/transport/tcp", 100 "//pkg/tcpip/transport/udp", 101 ], 102 ) 103 104 go_test( 105 name = "tcpip_test", 106 size = "small", 107 srcs = ["tcpip_test.go"], 108 library = ":tcpip", 109 deps = ["@com_github_google_go_cmp//cmp:go_default_library"], 110 ) 111 112 go_test( 113 name = "tcpip_x_test", 114 size = "small", 115 srcs = ["timer_test.go"], 116 deps = [":tcpip"], 117 )