Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
923c7a6f
Commit
923c7a6f
authored
May 22, 2019
by
Eric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] add i18T
parent
6c4b459b
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
303 additions
and
45 deletions
+303
-45
coco.po
cmd/locale/en_US/LC_MESSAGES/coco.po
+139
-9
coco.mo
cmd/locale/zh_CN/LC_MESSAGES/coco.mo
+0
-0
coco.po
cmd/locale/zh_CN/LC_MESSAGES/coco.po
+146
-16
banner.go
pkg/handler/banner.go
+4
-4
pagination.go
pkg/handler/pagination.go
+3
-3
session.go
pkg/handler/session.go
+7
-9
switch.go
pkg/proxy/switch.go
+4
-4
No files found.
cmd/locale/en_US/LC_MESSAGES/coco.po
View file @
923c7a6f
...
...
@@ -8,41 +8,171 @@ msgstr ""
"X-Generator: xgotext\n"
#. i18n.T
#: pkg/
sshd/handler/banner.go:16
msgid "
Welcome to use Jumpserver open source fortress system
"
#: pkg/
auth/server.go:17
msgid "
Please enter 6 digits.
"
msgstr ""
#. i18n.T
#: pkg/sshd/handler/banner.go:30
#: pkg/auth/server.go:18
msgid "[MFA auth]: "
msgstr ""
#. i18n.T
#: pkg/handler/banner.go:32
msgid "\t%d) Enter {{.GreenBoldColor}}%s{{.ColorEnd}} to %s.%s"
msgstr ""
#. i18n.T
#: pkg/sshd/handler/banner.go:44
#: pkg/handler/banner.go:47
msgid "Welcome to use Jumpserver open source fortress system"
msgstr ""
#. i18n.T
#: pkg/handler/banner.go:49
msgid "directly login"
msgstr ""
#. i18n.T
#: pkg/
sshd/handler/banner.go:45
#: pkg/
handler/banner.go:50
msgid "part IP, Hostname, Comment"
msgstr ""
#. i18n.T
#: pkg/
sshd/handler/banner.go:45
#: pkg/
handler/banner.go:50
msgid "to search login if unique"
msgstr ""
#. i18n.T
#: pkg/
sshd/handler/banner.go:46
#: pkg/
handler/banner.go:51
msgid "/ + IP, Hostname, Comment"
msgstr ""
#. i18n.T
#: pkg/
sshd/handler/banner.go:46
#: pkg/
handler/banner.go:51
msgid "to search, such as: /192.168"
msgstr ""
#. i18n.T
#: pkg/
sshd/handler/banner.go:47
#: pkg/
handler/banner.go:52
msgid "display the host you have permission"
msgstr ""
#. i18n.T
#: pkg/handler/banner.go:53
msgid "display the node that you have permission"
msgstr ""
#. i18n.T
#: pkg/handler/banner.go:54
msgid "refresh your assets and nodes"
msgstr ""
#. i18n.T
#: pkg/handler/banner.go:55
msgid "print help"
msgstr ""
#. i18n.T
#: pkg/handler/banner.go:56
msgid "exit"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "ID"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "hostname"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "IP"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "systemUsers"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "comment"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:152
msgid "Page: %d, Count: %d, Total Page: %d, Total Count: %d"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:179
msgid ""
"\n"
"Tips: Enter the asset ID and log directly into the asset.\n"
msgstr ""
#. i18n.T
#: pkg/handler/pagination.go:180
msgid ""
"\n"
"Page up: P/p\tPage down: Enter|N/n\tBACK: b.\n"
msgstr ""
#. i18n.T
#: pkg/handler/session.go:264
msgid "No Assets"
msgstr ""
#. i18n.T
#: pkg/handler/session.go:286
msgid "Node: [ ID.Name(Asset amount) ]"
msgstr ""
#. i18n.T
#: pkg/handler/session.go:287
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgstr ""
#. i18n.T
#: pkg/handler/session.go:301
msgid "Refresh done"
msgstr ""
#. i18n.T
#: pkg/proxy/parser.go:118
msgid "Command `%s` is forbidden"
msgstr ""
#. i18n.T
#: pkg/proxy/proxy.go:110
msgid "Connecting to %s@%s %.1f"
msgstr ""
#. i18n.T
#: pkg/proxy/proxy.go:128
msgid "System user <%s> and asset <%s> protocol are inconsistent."
msgstr ""
#. i18n.T
#: pkg/proxy/proxy.go:134
msgid ""
"Terminal only support protocol ssh/telnet, please use web terminal to access"
msgstr ""
#. i18n.T
#: pkg/proxy/proxy.go:161
msgid "Connect with api server failed"
msgstr ""
#. i18n.T
#: pkg/proxy/switch.go:136
msgid "Connect idle more than %d minutes, disconnect"
msgstr ""
#. i18n.T
#: pkg/proxy/switch.go:142
msgid "Terminated by administrator"
msgstr ""
cmd/locale/zh_CN/LC_MESSAGES/coco.mo
View file @
923c7a6f
No preview for this file type
cmd/locale/zh_CN/LC_MESSAGES/coco.po
View file @
923c7a6f
...
...
@@ -8,41 +8,171 @@ msgstr ""
"X-Generator: xgotext\n"
#. i18n.T
#: pkg/sshd/handler/banner.go:16
msgid "Welcome to use Jumpserver open source fortress system"
msgstr "欢迎使用Jumpserver开源堡垒机系统"
#: pkg/auth/server.go:17
msgid "Please enter 6 digits."
msgstr "请输入六位数字"
#. i18n.T
#: pkg/auth/server.go:18
msgid "[MFA auth]: "
msgstr "[MFA认证]"
#. i18n.T
#: pkg/
sshd/handler/banner.go:30
#: pkg/
handler/banner.go:32
msgid "\t%d) Enter {{.GreenBoldColor}}%s{{.ColorEnd}} to %s.%s"
msgstr "\t%d) 输入 {{.GreenBoldColor}}%s{{.ColorEnd}} 进行 %s.%s"
msgstr "\t%d) 输入 {{.GreenBoldColor}}%s{{.ColorEnd}} 进行%s.%s"
#. i18n.T
#: pkg/handler/banner.go:47
msgid "Welcome to use Jumpserver open source fortress system"
msgstr "欢迎使用Jumpserver开源堡垒机系统"
#. i18n.T
#: pkg/
sshd/handler/banner.go:44
#: pkg/
handler/banner.go:49
msgid "directly login"
msgstr "直接登陆"
#. i18n.T
#: pkg/
sshd/handler/banner.go:45
#: pkg/
handler/banner.go:50
msgid "part IP, Hostname, Comment"
msgstr ""
msgstr "
部分IP、主机名、备注
"
#. i18n.T
#: pkg/
sshd/handler/banner.go:45
#: pkg/
handler/banner.go:50
msgid "to search login if unique"
msgstr ""
msgstr "
进行搜索登录(如果唯一)
"
#. i18n.T
#: pkg/
sshd/handler/banner.go:46
#: pkg/
handler/banner.go:51
msgid "/ + IP, Hostname, Comment"
msgstr ""
msgstr "
/ + IP, 主机名 or 备注
"
#. i18n.T
#: pkg/
sshd/handler/banner.go:46
#: pkg/
handler/banner.go:51
msgid "to search, such as: /192.168"
msgstr ""
msgstr "
搜索, 如: /192.168
"
#. i18n.T
#: pkg/
sshd/handler/banner.go:47
#: pkg/
handler/banner.go:52
msgid "display the host you have permission"
msgstr ""
msgstr "显示您有权限的主机"
#. i18n.T
#: pkg/handler/banner.go:53
msgid "display the node that you have permission"
msgstr "显示您有权限的节点"
#. i18n.T
#: pkg/handler/banner.go:54
msgid "refresh your assets and nodes"
msgstr "刷新最新的机器和节点信息"
#. i18n.T
#: pkg/handler/banner.go:55
msgid "print help"
msgstr "显示帮助"
#. i18n.T
#: pkg/handler/banner.go:56
msgid "exit"
msgstr "退出"
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "ID"
msgstr "ID"
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "hostname"
msgstr "主机名"
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "IP"
msgstr "IP"
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "systemUsers"
msgstr "登录用户"
#. i18n.T
#: pkg/handler/pagination.go:133
msgid "comment"
msgstr "备注"
#. i18n.T
#: pkg/handler/pagination.go:152
msgid "Page: %d, Count: %d, Total Page: %d, Total Count: %d"
msgstr "页码: %d, 数量: %d, 总页数: %d, 总数量: %d"
#. i18n.T
#: pkg/handler/pagination.go:179
msgid ""
"\n"
"Tips: Enter the asset ID and log directly into the asset.\n"
msgstr "\n提示: 输入资产ID,直接登录资产.\n"
#. i18n.T
#: pkg/handler/pagination.go:180
msgid ""
"\n"
"Page up: P/p\tPage down: Enter|N/n\tBACK: b.\n"
msgstr "\n上一页: P/p 下一页: Enter|N/n 返回: B/b\n"
#. i18n.T
#: pkg/handler/session.go:264
msgid "No Assets"
msgstr "没有资产"
#. i18n.T
#: pkg/handler/session.go:286
msgid "Node: [ ID.Name(Asset amount) ]"
msgstr "节点: [ ID.名称(资产数量) ]"
#. i18n.T
#: pkg/handler/session.go:287
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgstr "提示: 输入 g+节点ID 显示节点下主机. 如: g1"
#. i18n.T
#: pkg/handler/session.go:301
msgid "Refresh done"
msgstr "刷新完成"
#. i18n.T
#: pkg/proxy/parser.go:118
msgid "Command `%s` is forbidden"
msgstr "命令 `%s` 是被禁止的 ..."
#. i18n.T
#: pkg/proxy/proxy.go:110
msgid "Connecting to %s@%s %.1f"
msgstr "开始连接到 %s@%s %.1f"
#. i18n.T
#: pkg/proxy/proxy.go:128
msgid "System user <%s> and asset <%s> protocol are inconsistent."
msgstr "系统用户<%s>和资产<%s>协议不一致"
#. i18n.T
#: pkg/proxy/proxy.go:134
msgid ""
"Terminal only support protocol ssh/telnet, please use web terminal to access"
msgstr "终端仅支持ssh/telnet协议,请使用web终端登录"
#. i18n.T
#: pkg/proxy/proxy.go:161
msgid "Connect with api server failed"
msgstr "连接API服务失败"
#. i18n.T
#: pkg/proxy/switch.go:136
msgid "Connect idle more than %d minutes, disconnect"
msgstr "空闲时间超过%d分钟,断开连接"
#. i18n.T
#: pkg/proxy/switch.go:142
msgid "Terminated by administrator"
msgstr "管理员中断连接"
pkg/handler/banner.go
View file @
923c7a6f
...
...
@@ -50,10 +50,10 @@ func init() {
{
id
:
2
,
instruct
:
i18n
.
T
(
"part IP, Hostname, Comment"
),
helpText
:
i18n
.
T
(
"to search login if unique"
)},
{
id
:
3
,
instruct
:
i18n
.
T
(
"/ + IP, Hostname, Comment"
),
helpText
:
i18n
.
T
(
"to search, such as: /192.168"
)},
{
id
:
4
,
instruct
:
"p"
,
helpText
:
i18n
.
T
(
"display the host you have permission"
)},
{
id
:
5
,
instruct
:
"g"
,
helpText
:
"display the node that you have permission"
},
{
id
:
6
,
instruct
:
"r"
,
helpText
:
"refresh your assets and nodes"
},
{
id
:
7
,
instruct
:
"h"
,
helpText
:
"print help"
},
{
id
:
8
,
instruct
:
"q"
,
helpText
:
"exit"
},
{
id
:
5
,
instruct
:
"g"
,
helpText
:
i18n
.
T
(
"display the node that you have permission"
)
},
{
id
:
6
,
instruct
:
"r"
,
helpText
:
i18n
.
T
(
"refresh your assets and nodes"
)
},
{
id
:
7
,
instruct
:
"h"
,
helpText
:
i18n
.
T
(
"print help"
)
},
{
id
:
8
,
instruct
:
"q"
,
helpText
:
i18n
.
T
(
"exit"
)
},
}
}
...
...
pkg/handler/pagination.go
View file @
923c7a6f
...
...
@@ -130,7 +130,7 @@ func (p *AssetPagination) Start() []model.Asset {
}
func
(
p
*
AssetPagination
)
displayPageAssets
()
{
Labels
:=
[]
string
{
i18n
.
T
(
"ID"
),
i18n
.
T
(
"
主机名"
),
i18n
.
T
(
"IP"
),
i18n
.
T
(
"系统用户"
),
i18n
.
T
(
"C
omment"
)}
Labels
:=
[]
string
{
i18n
.
T
(
"ID"
),
i18n
.
T
(
"
hostname"
),
i18n
.
T
(
"IP"
),
i18n
.
T
(
"systemUsers"
),
i18n
.
T
(
"c
omment"
)}
fields
:=
[]
string
{
"ID"
,
"hostname"
,
"IP"
,
"systemUsers"
,
"comment"
}
data
:=
make
([]
map
[
string
]
string
,
len
(
p
.
currentData
))
for
i
,
j
:=
range
p
.
currentData
{
...
...
@@ -176,8 +176,8 @@ func (p *AssetPagination) displayPageAssets() {
func
(
p
*
AssetPagination
)
displayTipsInfo
()
{
tips
:=
[]
string
{
"
\n
Tips: Enter the asset ID and log directly into the asset.
\n
"
,
"
\n
Page up: P/p Page down: Enter|N/n BACK: b.
\n
"
,
i18n
.
T
(
"
\n
Tips: Enter the asset ID and log directly into the asset.
\n
"
)
,
i18n
.
T
(
"
\n
Page up: P/p Page down: Enter|N/n BACK: b.
\n
"
)
,
}
for
_
,
tip
:=
range
tips
{
_
,
_
=
p
.
term
.
Write
([]
byte
(
tip
))
...
...
pkg/handler/session.go
View file @
923c7a6f
...
...
@@ -14,6 +14,7 @@ import (
"cocogo/pkg/cctx"
"cocogo/pkg/config"
"cocogo/pkg/i18n"
"cocogo/pkg/logger"
"cocogo/pkg/model"
"cocogo/pkg/proxy"
...
...
@@ -260,7 +261,7 @@ func (h *interactiveHandler) displayAssetsOrProxy(assets []model.Asset) {
func
(
h
*
interactiveHandler
)
displayAssets
(
assets
model
.
AssetList
)
{
if
len
(
assets
)
==
0
{
_
,
_
=
io
.
WriteString
(
h
.
term
,
"
\r\n
No Assets
\r
\n\r
"
)
_
,
_
=
io
.
WriteString
(
h
.
term
,
i18n
.
T
(
"No Assets"
)
+
"
\n\r
"
)
}
else
{
sortedAssets
:=
assets
.
SortBy
(
config
.
GetConf
()
.
AssetListSortBy
)
pag
:=
NewAssetPagination
(
h
.
term
,
sortedAssets
)
...
...
@@ -282,12 +283,12 @@ func (h *interactiveHandler) displayAssets(assets model.AssetList) {
func
(
h
*
interactiveHandler
)
displayNodes
(
nodes
[]
model
.
Node
)
{
tree
:=
ConstructAssetNodeTree
(
nodes
)
tipHeaderMsg
:=
"
\r\n
Node: [ ID.Name(Asset amount) ]"
tipEndMsg
:=
"Tips: Enter g+NodeID to display the host under the node, such as g1
\r\n\r
"
tipHeaderMsg
:=
i18n
.
T
(
"Node: [ ID.Name(Asset amount) ]"
)
tipEndMsg
:=
i18n
.
T
(
"Tips: Enter g+NodeID to display the host under the node, such as g1"
)
_
,
err
:=
io
.
WriteString
(
h
.
term
,
tipHeaderMsg
)
_
,
err
:=
io
.
WriteString
(
h
.
term
,
"
\n\r
"
+
tipHeaderMsg
)
_
,
err
=
io
.
WriteString
(
h
.
term
,
tree
.
String
())
_
,
err
=
io
.
WriteString
(
h
.
term
,
tipEndMsg
)
_
,
err
=
io
.
WriteString
(
h
.
term
,
tipEndMsg
+
"
\n\r
"
)
if
err
!=
nil
{
logger
.
Info
(
"displayAssetNodes err:"
,
err
)
}
...
...
@@ -297,7 +298,7 @@ func (h *interactiveHandler) displayNodes(nodes []model.Node) {
func
(
h
*
interactiveHandler
)
refreshAssetsAndNodesData
()
{
h
.
loadUserAssets
(
"2"
)
h
.
loadUserAssetNodes
(
"2"
)
_
,
err
:=
io
.
WriteString
(
h
.
sess
,
"Refresh done
\r\n
"
)
_
,
err
:=
io
.
WriteString
(
h
.
term
,
i18n
.
T
(
"Refresh done"
)
+
"
\n\r
"
)
if
err
!=
nil
{
logger
.
Error
(
"refresh Assets Nodes err:"
,
err
)
}
...
...
@@ -360,9 +361,6 @@ func (h *interactiveHandler) searchNodeAssets(num int) (assets []model.Asset) {
}
func
(
h
*
interactiveHandler
)
Proxy
(
ctx
context
.
Context
)
{
//h.assetSelect = &model.Asset{Hostname: "centos", Port: 22, Ip: "192.168.244.185", Protocol: "ssh"}
//h.systemUserSelect = &model.SystemUser{Id: "5dd8b5a0-8cdb-4857-8629-faf811c525e1", Name: "web", Username: "root", Password: "redhat", Protocol: "telnet"}
userConn
:=
&
proxy
.
UserSSHConnection
{
Session
:
h
.
sess
}
p
:=
proxy
.
ProxyServer
{
UserConn
:
userConn
,
...
...
pkg/proxy/switch.go
View file @
923c7a6f
...
...
@@ -133,15 +133,15 @@ func (s *SwitchSession) Bridge(userConn UserConnection, srvConn ServerConnection
select
{
// 检测是否超过最大空闲时间
case
<-
time
.
After
(
time
.
Duration
(
s
.
MaxIdleTime
)
*
time
.
Minute
)
:
msg
:=
i18n
.
T
(
fmt
.
Sprintf
(
"
\n\r
Connect idle more than %d minutes, disconnect"
,
s
.
MaxIdleTime
)
)
msg
:=
fmt
.
Sprintf
(
i18n
.
T
(
"Connect idle more than %d minutes, disconnect"
),
s
.
MaxIdleTime
)
msg
=
utils
.
WrapperWarn
(
msg
)
utils
.
IgnoreErrWriteString
(
s
.
userTran
,
msg
)
utils
.
IgnoreErrWriteString
(
s
.
userTran
,
"
\n\r
"
+
msg
)
return
// 手动结束
case
<-
s
.
ctx
.
Done
()
:
msg
:=
i18n
.
T
(
"
\n\r
Terminated by administrator"
)
msg
:=
i18n
.
T
(
"Terminated by administrator"
)
msg
=
utils
.
WrapperWarn
(
msg
)
utils
.
IgnoreErrWriteString
(
userConn
,
msg
)
utils
.
IgnoreErrWriteString
(
userConn
,
"
\n\r
"
+
msg
)
return
// 监控窗口大小变化
case
win
:=
<-
winCh
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment