Commit Graph

17 Commits

Author SHA1 Message Date
Eng Zer Jun c55a4ac779
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-27 14:56:57 +08:00
Sebastiaan van Stijn 427ad30c05
libnetwork: remove unused "testutils" imports
Perhaps the testutils package in the past had an `init()` function to set up
specific things, but it no longer has. so these imports were doing nothing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-18 14:20:37 +02:00
Brian Goff 4b981436fe Fixup libnetwork lint errors
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:32 +00:00
Brian Goff a0a473125b Fix libnetwork imports
After moving libnetwork to this repo, we need to update all the import
paths for libnetwork to point to docker/docker/libnetwork instead of
docker/libnetwork.
This change implements that.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 21:51:23 +00:00
Flavio Crisciani 1784a46e64 Enable network-db test image creation
Updated makefile
Moved binaries in the bin/ directory

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-05-29 08:03:32 -07:00
Derek McGowan ccabedfbe3 Fix file descriptor leaks
Ensures network connections and file are closed when done writing.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-07-01 16:29:51 -07:00
Santhosh Manohar 82f3d55fa4 Fix out of bound slice access in Delete()
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-03-06 10:03:03 -08:00
Tim Hockin 92af10a0fe Extract hostname from (hostname.domainname)
This approach allows the user to provide a FQDN as hostname if that is what
they want in their container, or to provide distinct host and domain parts.  In
both cases we will correctly extract the first token for /etc/hosts.

Signed-off-by: Tim Hockin <thockin@google.com>
2016-02-29 10:39:50 -08:00
Vincent Demeester 421a3ec5d7 Use gofmt with -s instead of goimports
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-02-12 14:07:00 +01:00
Travis Thieman c6dfe4b795 Fix etchosts.Update to not target hosts with given hostname as prefix
Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
2016-01-10 10:58:49 -05:00
Alexander Morozov 36a8f5822c Use simple scanner instead of regexp for etchosts.Delete
Benchmark results:
benchmark           old ns/op     new ns/op     delta
BenchmarkDelete     4315186       2245829       -47.96%

benchmark           old allocs     new allocs     delta
BenchmarkDelete     4645           10             -99.78%

benchmark           old bytes     new bytes     delta
BenchmarkDelete     1590011       4832          -99.70%

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-10-23 13:36:30 -07:00
Alexander Morozov de7607f509 Add benchmark for etchosts.Delete
Also added more checks to test

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-10-23 13:36:30 -07:00
Jana Radhakrishnan cdb82dc22d Synchronize /etc/hosts updates at file level
Introduced a path level lock to synchronize updates
to /etc/hosts writes. A path level cache is maintained
to only synchronize only at the file level.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-10-21 07:45:29 -07:00
David Calavera cc02894a50 Move test specific functions to a testutils package.
This way we won't vendor test related functions in docker anymore.
It also moves netns related functions to a new ns package to be able to
call the ns init function in tests. I think this also helps with the
overall package isolation.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-07 13:33:28 -04:00
Jana Radhakrishnan 28c2445dad Do not update /etc/hosts for empty endpoints
There is no need to update the /etc/hosts files
of containers for endpoints which are created/deleted
in a network whose interface list is empty

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-24 12:09:44 -07:00
Jana Radhakrishnan 362568467d Add/Delete etc hosts record support
Currently the etchosts package only provides helpers
to completely build an /etc/hosts file from scratch
or update a single hostname's IP address to a different
one. This commit adds the ability to add/delete an arbitrary
number of host record entries to/from the etc hosts file

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-19 00:40:27 -07:00
Alessandro Boch f16db2c3ad Remove pkg directory
- As recommended by Docker committers.
- Will introduce internal directory when go supports it

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-16 16:12:13 -07:00