Add checksums to pipe, cp, mirror commands.
> Add checksum to uploaded object. Values: MD5, CRC32, CRC32C, SHA1 or SHA256. Requires server trailing headers support like AWS, MinIO and possibly others.
`--md5` is hidden, but still applied.
Uploads to buckets with object locking will still use MD5.
Bonus: `mc stat` shows checksum information.
allow users to avoid list() call when an object does not
exist when following flags are used with `mc stat`
```
--no-list (HEAD the latest version)
--version-id <vid>
```
Also avoid superflous url2Stat() calls while processing
the args, there is no real reason to do that.
add global `--resolve HOST[:PORT]:IP` flag
This commit adds support for custom DNS overwrites via one or multiple
`--resolve` flags. It allows `mc` users to define custom DNS mappings
from a HOST (and optional port) to an IP address.
For example:
```
mc --resolve foo.com:9000=10.1.2.3 ls myminio/mybucket
```
The `--resolve` syntax is taken from cURL. Ref. `curl --help dns`
Use cases:
1. DNS overwrites. If there are no DNS resolvers available, e.g.
due to a temp. outage, this allows `mc` to connect to a defined
alias as long as the IP of the one or multiple cluster nodes are
known. It also allows `mc` to overwrite the current DNS responses.
This is useful for various tests in dev and staging environments.
2. TLS certificate verification. Often TLS certificates are issued
for some DNS names (via SAN) but not for IP addresses. IP addresses
are usually not static and might change anytime. Accessing a MinIO
cluster that serves a certificate containing only DNS SANs via an
IP address results in a TLS certificate verification error - even
if the certificate is issued by a trusted CA. The current workaround
is the `--insecure` flag which disables TLS certification completely.
Example for TLS verification:
```
$ mc alias set 'myminio' 'https://192.168.188.118:9000' 'minioadmin' 'minioadmin'
mc: <ERROR> Unable to initialize new alias from the provided credentials.
Get "https://192.168.188.118:9000": tls: failed to verify certificate:
x509: cannot validate certificate for 192.168.188.118 because it doesn't contain any IP SANs.
```
```
mc alias set --resolve foo.com:9000=192.168.188.118 'myminio' 'https://foo.com:9000' 'minioadmin' 'minioadmin'
Added `myminio` successfully.
```
Signed-off-by: Andreas Auernhammer <github@aead.dev>
currently STS specific behavior is global,
`mc` however supports multiple aliases - we
need to make sure that `mc` treats this ENV
specific to an alias.
The new error message is:
```
$ mc rb --force play/testbucket/dir/
mc: <ERROR> Failed to remove `play/testbucket/dir/`. Bucket name `testbucket/dir/` not valid.
```
isURLPrefixExists() is used after url2Stat() function to check if the
given aliased URL corresponds to an existing prefix in the server. However,
url2Stat() is already doing that and returns valid information for
those prefixes.
Removing isURLPrefixExists() all together.
client-s3.Stat() does not properly detect a prefix when there is another
lower one,
e.g: Stat() of 'dir/' fails when there is 'dir-name/' in the same parent
prefix.