Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS support #121

Closed
wants to merge 1 commit into from
Closed

TLS support #121

wants to merge 1 commit into from

Conversation

bruceesmith
Copy link

Support of memcached TLS

Add support for the (experimental) TLS feature of memcached TLS

Function NewWithTLS(config *tls.Config, server ...string) *Client is added. Simply pass in a *tls.Config whose settings match those of the memcached daemon, then all other methods of gomemcache operate identically to those of the normal (non-TLS) case.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@bruceesmith
Copy link
Author

@googlebot I signed it!

@bruceesmith
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@QuChen88
Copy link

@bradfitz Ping. Can you please take a look at this and maybe merge it?

It will be great to have TLS support for this client.

@bradfitz
Copy link
Owner

bradfitz commented Sep 3, 2023

I'd prefer a new exported field on Client, not a new constructor.

Also, each server shard might have its own hostname/tls.Config. The option on Client should be more like TLSConfigForerver func(target string) (_ *tls.Config, ok bool) probably.

Ideally there would be tests too. I tried to run it against memcached built with TLS enabled and I couldn't even get memcached on Debian stable to work. (I'm surprised it'd need anything newer, so I was likely holding it wrong but then ran out of time.)

@bradfitz bradfitz removed the cla: yes label Sep 4, 2023
@bradfitz
Copy link
Owner

bradfitz commented Sep 4, 2023

Ideally there would be tests too. I tried to run it against memcached built with TLS enabled and I couldn't even get memcached on Debian stable to work. (I'm surprised it'd need anything newer, so I was likely holding it wrong but then ran out of time.)

I've addressed this part. This package now has better tests & GitHub Actions CI hooked up.

@bruceesmith
Copy link
Author

I'm very sorry @bradfitz and @QuChen88, I just don't have the hours in my day at present to adjust my PR based on Brad's comments .........

bradfitz added a commit that referenced this pull request Sep 5, 2023
Turns out we already have the necessary hook (DialContext), which was
added in #158.

Updates #121

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
@bradfitz
Copy link
Owner

bradfitz commented Sep 5, 2023

Turns out we don't actually need this since #158, @bruceesmith. That hook already provides everything necessary to do TLS dials.

I sent #169 to add a test & mention in the docs.

bradfitz added a commit that referenced this pull request Sep 5, 2023
Turns out we already have the necessary hook (DialContext), which was
added in #158.

Updates #121

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
@bradfitz bradfitz closed this Sep 5, 2023
cbosss added a commit to netlify/gomemcache that referenced this pull request Mar 6, 2024
* Convert to string using rune() (bradfitz#123)

See golang/go#32479

Fixes bradfitz#122.

Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>

* delete an unused type

* feat: add support for append/prepend

* Update README.md

* memcache: add Client.Close method

Updates bradfitz#155 from @renanbastos93

Co-authored-by: renanbastos93 <renanbastos.tec@gmail.com>

* feat: support custom dialer

* support custom DialContext

* add minimal Go memcached server for tests

* go.mod: bump minimum Go from 1.12 to Go 1.18

Go 1.18 is what's in Ubuntu 22.04 LTS (Jammy). The later Ubuntus have
1.19, 1.20, and 1.21 (the current Go release)

Go 1.18 seems fine. Go 1.18 came out 2022-03-15, about 1.5 years ago.

* docs(readme): update README.md

* add AUTHORS file, adjust copyright headers

Signed-off-by: Brad Fitzpatrick <brad@danga.com>

* add start of GitHub Actions CI

* README.md: remove some dated Go notes

Signed-off-by: Brad Fitzpatrick <brad@danga.com>

* run the three main test types in parallel

Saves about six seconds overall, as each test currently involves a
three second sleep.

* add CompareAndSwap (cas) tests

Signed-off-by: Brad Fitzpatrick <brad@danga.com>

* Export Compare-And-Swap (CAS) id in Item

Even though the CAS id is a transparent token there are use cases where the
client of the module could be interested in storing the token from a retrieved
Item out-of-process for later use with a CAS operation. This is impossible if
the field is unexported.

* raise DefaultTimeout from 100ms to 500ms

Various memcached concentrator things (and things with disks) are more
common now (and TLS implementations with more round-trips). The
assumption of all memcached access being within the same rack/LAN
might no longer be appropriate.

Updates bradfitz#114

Signed-off-by: Brad Fitzpatrick <brad@danga.com>

* add TLS integration test, update Client.DialContext docs

Turns out we already have the necessary hook (DialContext), which was
added in bradfitz#158.

Updates bradfitz#121

Signed-off-by: Brad Fitzpatrick <brad@danga.com>

* tweak tests

* move validation

---------

Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
Co-authored-by: Robert-André Mauchin <30413512+eclipseo@users.noreply.github.com>
Co-authored-by: Saimon Shaplygin <semyuon@gmail.com>
Co-authored-by: Justin Vanderhooft <justinvdhooft@gmail.com>
Co-authored-by: Friedrich42 <39532283+Friedrich42@users.noreply.github.com>
Co-authored-by: Brad Fitzpatrick <brad@danga.com>
Co-authored-by: renanbastos93 <renanbastos.tec@gmail.com>
Co-authored-by: Irina Marchuk <mar4ukira@gmail.com>
Co-authored-by: mingrammer <mingrammer@gmail.com>
Co-authored-by: martins <martin.soderstrom@aurorainnovation.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants