Skip to content
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: 显示内网地址及外网地址 #1

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,27 @@ function Init_Panel(){
done
}

function Get_Ip(){
active_interface=$(ip route get 8.8.8.8 | awk 'NR==1 {print $5}')
if [[ -z $active_interface ]];then
LOCAL_IP="127.0.0.1"
else
LOCAL_IP=`ip -4 addr show dev "$active_interface" | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`
fi

PUBLIC_IP=`curl -s https://api64.ipify.org`
if [[ -z "$PUBLIC_IP" ]];then
PUBLIC_IP="N/A"
fi
}

function Show_Result(){
log ""
log "=================感谢您的耐心等待,安装已经完成=================="
log ""
log "请用浏览器访问面板:"
log "面板地址: http://\$LOCAL_IP:$PANEL_PORT/$PANEL_ENTRANCE"
log "外网地址: http://$PUBLIC_IP:$PANEL_PORT/$PANEL_ENTRANCE"
log "内网地址: http://$LOCAL_IP:$PANEL_PORT/$PANEL_ENTRANCE"
log "用户名称: $PANEL_USERNAME"
log "用户密码: $PANEL_PASSWORD"
log ""
Expand All @@ -285,6 +300,7 @@ function main(){
Set_Username
Set_Password
Init_Panel
Get_Ip
Show_Result
}
main