-
Notifications
You must be signed in to change notification settings - Fork 152
Conversation
no we don't need for shared data as here we are having them only because it's the serialization format for properties vs shared data API doesn't have any format at the ABI level. |
properties/types.go
Outdated
const ( | ||
// InterceptionNone indicates that the workload is not using IPtables for traffic interception | ||
None IstioTrafficInterceptionMode = iota | ||
// InterceptionTproxy implies traffic intercepted by IPtables with TPROXY mode | ||
Tproxy | ||
// InterceptionRedirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode | ||
Redirect | ||
) |
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.
please prefix the global "enum" by its type name as I suggested ^ to have clean namespace in the pkg
const ( | |
// InterceptionNone indicates that the workload is not using IPtables for traffic interception | |
None IstioTrafficInterceptionMode = iota | |
// InterceptionTproxy implies traffic intercepted by IPtables with TPROXY mode | |
Tproxy | |
// InterceptionRedirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode | |
Redirect | |
) | |
const ( | |
// IstioTrafficInterceptionModeNone indicates that the workload is not using IPtables for traffic interception | |
IstioTrafficInterceptionModeNone IstioTrafficInterceptionMode = iota | |
// IstioTrafficInterceptionModeTproxy implies traffic intercepted by IPtables with TPROXY mode | |
IstioTrafficInterceptionModeTproxy | |
// IstioTrafficInterceptionModeRedirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode | |
IstioTrafficInterceptionModeRedirect | |
) |
talked offline - let's move the serde functions after landing this PR and place it under |
@mathetake fixed the final linter warnings as well. if you give it a go with the changes I made based on your good feedback, we can merge. |
type EnvoyTrafficDirection int | ||
|
||
const ( | ||
// Unspecified means that the direction is not specified. | ||
Unspecified EnvoyTrafficDirection = iota | ||
// Inbound means that the transport is used for incoming traffic. | ||
Inbound | ||
// Outbound means that the transport is used for outgoing traffic. | ||
Outbound | ||
) |
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.
type EnvoyTrafficDirection int | |
const ( | |
// Unspecified means that the direction is not specified. | |
Unspecified EnvoyTrafficDirection = iota | |
// Inbound means that the transport is used for incoming traffic. | |
Inbound | |
// Outbound means that the transport is used for outgoing traffic. | |
Outbound | |
) | |
type EnvoyTrafficDirection int | |
const ( | |
// EnvoyTrafficDirectionUnspecified means that the direction is not specified. | |
EnvoyTrafficDirectionUnspecified EnvoyTrafficDirection = iota | |
// EnvoyTrafficDirectionInbound means that the transport is used for incoming traffic. | |
EnvoyTrafficDirectionInbound | |
// EnvoyTrafficDirectionOutbound means that the transport is used for outgoing traffic. | |
EnvoyTrafficDirectionOutbound | |
) |
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.
Cfr #403 (comment)
|
type IstioTrafficInterceptionMode int | ||
|
||
const ( | ||
// None indicates that the workload is not using IPtables for traffic interception. | ||
None IstioTrafficInterceptionMode = iota | ||
// Tproxy implies traffic intercepted by IPtables with TPROXY mode. | ||
Tproxy | ||
// Redirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode. | ||
Redirect | ||
) |
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.
type IstioTrafficInterceptionMode int | |
const ( | |
// None indicates that the workload is not using IPtables for traffic interception. | |
None IstioTrafficInterceptionMode = iota | |
// Tproxy implies traffic intercepted by IPtables with TPROXY mode. | |
Tproxy | |
// Redirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode. | |
Redirect | |
) | |
type IstioTrafficInterceptionMode int | |
const ( | |
// IstioTrafficInterceptionModeNone indicates that the workload is not using IPtables for traffic interception. | |
IstioTrafficInterceptionModeNone IstioTrafficInterceptionMode = iota | |
// IstioTrafficInterceptionModeTproxy implies traffic intercepted by IPtables with TPROXY mode. | |
IstioTrafficInterceptionModeTproxy | |
// IstioTrafficInterceptionModeRedirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode. | |
IstioTrafficInterceptionModeRedirect | |
) |
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.
The most idiomatic Go comments are those that are clear, concise, and directly above the item they're describing. The Go community values clarity and simplicity, and the official Go documentation often uses the style seen in the first example.
Therefore, the first example is the most idiomatic:
const (
// None indicates that the workload is not using IPtables for traffic interception.
None IstioTrafficInterceptionMode = iota
// Tproxy implies traffic intercepted by IPtables with TPROXY mode.
Tproxy
// Redirect implies traffic intercepted by IPtables with REDIRECT mode. This is our default mode.
Redirect
)
The comments are directly above the constants they describe, and they don't repeat the constant's name, which is redundant and not necessary. The other examples are more verbose and less idiomatic.
Online examples can be found in plenty upstream well adopted modules. An example of the net/http
package
https://cs.opensource.google/go/go/+/refs/tags/go1.21.3:src/net/http/server.go;l=2873
PS: IstioTrafficInterceptionModeRedirect
does not make any sense, as this string would not even be useful in code nor documents (where does the type name start and end?). IstioTrafficInterceptionMode.Redirect
(with the dot) would make a bit more sense, but is not as golang idiomatic as mentioned in the initial argument.
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.
After the prefix nits are resolved, will merge it
Ported the work done in WASM plugins to expose the properties API.
serialization.go
types.go
utils.go
TBD with @mathetake @jcchavezs @nacx
marshaling
andunmarshaling
functions should not be exclusive toproperties
api, as they are essential for the shared data API between different plugins as wellEnvoy
vsIstio
specific logic, although this is now already cleanly separated in different files