-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
channelz: stage 4 - add security and socket option info #1965
Conversation
4a9d37c
to
6028f3b
Compare
19be72a
to
899fbf0
Compare
Reviewed 10 of 20 files at r1, 4 of 7 files at r2. channelz/types.go, line 423 at r2 (raw file):
Move this to a sub package?
channelz/types_linux.go, line 24 at r2 (raw file):
Will this import cause the build to fail on non-linux? Or just function calls will return error? channelz/types_linux.go, line 30 at r2 (raw file):
This field is not defined in channelz/util_default.go, line 1 at r2 (raw file):
Rename this file. channelz/util_unix_go19.go, line 1 at r2 (raw file):
Why do we need this build constraint? channelz/util_unix_go19.go, line 29 at r2 (raw file):
This is also a helper function, not part of the API. channelz/service/service.go, line 38 at r2 (raw file):
Make a function to do the time conversion. channelz/service/service.go, line 145 at r2 (raw file):
Move credentials/credentials.go, line 35 at r2 (raw file):
Delete blank line. credentials/credentials.go, line 172 at r2 (raw file):
Names of the fields. credentials/credentials_util_go19.go, line 5 at r2 (raw file):
2018 credentials/credentials_util_go19.go, line 36 at r2 (raw file):
Since we only care about method rawConn.(interface{
SyscallConn() (syscall.RawConn, error)
}) So we don't need the But this works only if credentials/credentials_util_pre_go19.go, line 5 at r2 (raw file):
2018 credentials/credentials_util_pre_go19.go, line 30 at r2 (raw file):
Why keeping the rawConn? test/channelz_test.go, line 125 at r2 (raw file):
Revert this. Comments from Reviewable |
Review status: 3 of 17 files reviewed at latest revision, 15 unresolved discussions. channelz/types.go, line 423 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
moved to credentials package. channelz/util_unix_go19.go, line 1 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
https://github.com/golang/sys/blob/master/unix/syscall_unix.go contains definition for function like GetsockoptLinger, GetsockoptTimeval, and it has the build tag listed here. Therefore, I have to have the same build tag here. FYI, I've made some changes to the build tag. channelz/util_unix_go19.go, line 29 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
If we move this function to transport package, the it will complicate the package by adding two more files for different go version. channelz/service/service.go, line 38 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/service/service.go, line 145 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
done credentials/credentials.go, line 35 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
done credentials/credentials.go, line 172 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
done credentials/credentials_util_go19.go, line 5 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
done credentials/credentials_util_go19.go, line 36 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
Unfortunately, syscall.RawConn is not defined pre 1.9 credentials/credentials_util_pre_go19.go, line 5 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
done credentials/credentials_util_pre_go19.go, line 30 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
That's how we get the socket options, i.e. by doing the SyscallConn(rawConn) and then Control() channelz/types_linux.go, line 24 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
nice catch! channelz/types_linux.go, line 30 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
I added some dummy struct definitions for SocketOptionData for non unix build channelz/util_default.go, line 1 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
renamed to util_nonlinux_pre_go19.go test/channelz_test.go, line 125 at r2 (raw file): Previously, menghanl (Menghan Li) wrote…
ok Comments from Reviewable |
Reviewed 1 of 23 files at r1, 10 of 19 files at r3. channelz/types_nonunixes.go, line 71 at r3 (raw file):
This is a strong assumption that non-unix systems will have similar concepts with unix. Looking at the proto def for socket option, the real data field is a channelz/service/service.go, line 38 at r2 (raw file): Previously, lyuxuan wrote…
Hmm, what I meant is a function that returns credentials/credentials.go, line 237 at r3 (raw file):
The names for the interfaces are OK in channelz package, but inappropriate in credentials package. Rename this or move it to channelz/subpackage Comments from Reviewable |
Reviewed 1 of 23 files at r1, 3 of 19 files at r3. channelz/util_test.go, line 31 at r3 (raw file):
Remove this blank line. channelz/util_test.go, line 65 at r3 (raw file):
something is wrong with this channelz/util_test.go, line 73 at r3 (raw file):
The content of this struct will be modified by the syscall later, right? channelz/util_test.go, line 110 at r3 (raw file):
defer channelz/service/service.go, line 153 at r3 (raw file):
Move this code around so you create one local variable and only set its field when error is not nil. channelz/service/service.go, line 168 at r3 (raw file):
Move this and other code that accesses internal fields of SocketOptionData to _unix.go and _nonunix.go files. So you won't need the dummy non-unix types, either. channelz/service/service.go, line 168 at r3 (raw file):
And put the fields of the struct to multiple lines. channelz/service/service_test.go, line 35 at r3 (raw file):
channelzpb "google.golang.org/grpc/channelz/" channelz/service/service_test.go, line 41 at r3 (raw file):
Move this next to the definition of channelz/service/service_test.go, line 180 at r3 (raw file):
Similar to previous comments on making a function to convert duration, this and the following credentials/credentials_util_go19.go, line 35 at r3 (raw file):
Add a comment that this implements interface Comments from Reviewable |
Review status: all files reviewed at latest revision, 14 unresolved discussions, some commit checks failed. channelz/types_nonunixes.go, line 71 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
Discussed offline: to generate any proto, it will add pb dependency to channelz package, which will eventually lead to a cyclic import path. channelz/util_test.go, line 31 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/util_test.go, line 65 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
fixed channelz/util_test.go, line 73 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
the value here is to set the fd, and we will read from the fd to verify the set and get functionality. channelz/util_test.go, line 110 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/service/service.go, line 38 at r2 (raw file):
channelz/service/service.go, line 153 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/service/service.go, line 168 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/service/service.go, line 168 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/service/service_test.go, line 35 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
I think this is obsolete, right? channelz/service/service_test.go, line 41 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done channelz/service/service_test.go, line 180 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done credentials/credentials.go, line 237 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
rename to ExtraSecurityInfo. It's better to be in credentials package as people implementing credentials will notice it. credentials/credentials_util_go19.go, line 35 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
done Comments from Reviewable |
Reviewed 10 of 13 files at r4. channelz/util_test.go, line 65 at r3 (raw file): Previously, lyuxuan wrote…
But what's the purpose of function It seems to me what you actually want is just ln, _ := net.Listen(network, addr)
go func() { ln.Accept() } ()
conn, _ := net.Dial() Comments from Reviewable |
Review status: 11 of 19 files reviewed at latest revision, 1 unresolved discussion. channelz/util_test.go, line 65 at r3 (raw file):
Comments from Reviewable |
Reviewed 1 of 13 files at r4, 8 of 8 files at r5. credentials/credentials.go, line 237 at r5 (raw file):
Nit: If there's no plan to use this and the following types for anything else, I would include the word "channelz" in all the names, like Comments from Reviewable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had one last nit on the names ExtraSecurityInfo
vs ChannelzSecurityInfo
.
LGTM otherwise.
d483aaa
to
e8b54a4
Compare
Breaks darwin builds. Revert in #2096. |
This change is