Commit Graph

10 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
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
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
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
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