-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
feat(icmp) support DoNotFragment + Size #633
base: master
Are you sure you want to change the base?
Changes from 3 commits
4a2b642
65f24e9
4515572
4f1cd93
39952da
e71d178
2e3c5bb
104ec1d
30aea72
2340f65
4c0a523
73c0ff2
e9703ec
ccafe4b
a2ebfd1
dbe1815
88c94e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,8 @@ var ( | |
Insecure: false, | ||
IgnoreRedirect: false, | ||
Timeout: defaultTimeout, | ||
Icmp: &Icmp{ | ||
Df: false, | ||
ICMPConfig: &ICMPConfig{ | ||
DF: false, | ||
Size: defaultSize, | ||
}, | ||
} | ||
|
@@ -61,7 +61,7 @@ type Config struct { | |
DNSResolver string `yaml:"dns-resolver,omitempty"` | ||
|
||
// See ICMP for more details. | ||
Icmp *Icmp `yaml:"icmp,omitempty"` | ||
ICMPConfig *ICMPConfig `yaml:"icmp,omitempty"` | ||
|
||
// OAuth2Config is the OAuth2 configuration used for the client. | ||
// | ||
|
@@ -83,11 +83,9 @@ type DNSResolverConfig struct { | |
} | ||
|
||
// ICMP is the configuration for the ICMP client specific config | ||
type Icmp struct { | ||
// Don't Fragment flag (DF) for the client | ||
Df bool `yaml:"df"` | ||
// Size of the packet | ||
Size int `yaml:"size"` | ||
type ICMPConfig struct { | ||
DF bool `yaml:"df"` // Don't Fragment flag used for the ICMP client | ||
Size int `yaml:"size"` // Size of the packet | ||
} | ||
|
||
// OAuth2Config is the configuration for the OAuth2 client credentials flow | ||
|
@@ -110,15 +108,15 @@ func (c *Config) ValidateAndSetDefaults() error { | |
} | ||
|
||
// Only validate or set defaults for Icmp if it's not nil | ||
if c.Icmp != nil { | ||
if c.ICMPConfig != nil { | ||
// limit for pro-ping, below 25 it's not working | ||
if c.Icmp.Size < 25 { | ||
c.Icmp.Size = 25 | ||
if c.ICMPConfig.Size < 25 { | ||
c.ICMPConfig.Size = 25 | ||
} | ||
} else { | ||
// If Icmp is nil, let's initialize it with default values | ||
c.Icmp = &Icmp{ | ||
Df: false, | ||
c.ICMPConfig = &ICMPConfig{ | ||
DF: false, | ||
Size: 25, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've set this configuration because it's the only way I've found to make it work. I did the tests by validating with network captures:
But then, If I don't specifiy anything in icmp in my yaml file, the ping is not working. That's why I put this code with the Size in it.
But maybe this is not the good way to initialise it. If I test with a Size <24 it doesn't work either. That's why I put
And my mistake: the limit is 24, not 25. |
||
} | ||
} | ||
|
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.