aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-09-14 01:08:46 +0700
committerShulhan <ms@kilabit.info>2023-09-14 01:08:46 +0700
commit3f1d70d63391593e2dbbbcadcbf93ba7e844d51f (patch)
tree6a0aa040e3deac4bbae4ab279171a2bf59ee69be /lib/ssh
parentb89afa24feaee375e914a69b23c2036733991f3e (diff)
downloadpakakeh.go-3f1d70d63391593e2dbbbcadcbf93ba7e844d51f.tar.xz
ssh/config: change the FieldInt to FieldInt64 that return int64
Using the maximum int64 allow the section key contains value larger than int.
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/config/section.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/ssh/config/section.go b/lib/ssh/config/section.go
index 99075cd9..a2129904 100644
--- a/lib/ssh/config/section.go
+++ b/lib/ssh/config/section.go
@@ -189,7 +189,7 @@ type Section struct {
// Field store the unpacked key and value of Section.
// For section key that is not expecting string value, one can use
- // FieldBool or FieldInt.
+ // FieldBool or FieldInt64.
Field map[string]string
// env contains the key and value from SetEnv field.
@@ -331,16 +331,15 @@ func (section *Section) FieldBool(key string) (vbool bool) {
return vbool
}
-// FieldInt get the Field value as int.
-// It the value is unparseable as numeric it will return 0.
-func (section *Section) FieldInt(key string) (vint int) {
+// FieldInt64 get the Field value as int64.
+// If the value is unparseable as int64 it will return 0.
+func (section *Section) FieldInt64(key string) (val int64) {
var vstr = section.Field[key]
if len(vstr) == 0 {
return 0
}
- var vi64 int64
- vi64, _ = strconv.ParseInt(vstr, 10, 64)
- return int(vi64)
+ val, _ = strconv.ParseInt(vstr, 10, 64)
+ return val
}
// Hostname return the hostname of this section.