1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge pull request #232 from Ysurac/develop

sync
This commit is contained in:
suyuan 2022-04-15 10:34:22 +08:00 committed by GitHub
commit dc61fc14dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 0 deletions

60
grpcurl/Makefile Normal file
View file

@ -0,0 +1,60 @@
#
# Copyright (C) 2022 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=grpcurl
PKG_VERSION:=1.8.6
PKG_RELEASE:=1
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/fullstorydev/grpcurl/archive/refs/tags/
PKG_HASH:=18b457f644baabeef0de350596dd8d23563586ee94a3ed3cb290063e097ab934
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Yannick Chabanois <ycarus@zugaina.org>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/fullstorydev/grpcurl
GO_PKG_BUILD_PKG:=github.com/fullstorydev/grpcurl/cmd/grpcurl
GO_PKG_LDFLAGS_X:= \
$(GO_PKG)/constant.Version=$(PKG_VERSION) \
$(GO_PKG)/constant.Commit=v$(PKG_VERSION)
GO_PKG_LDFLAGS:=-s -w
GO_PKG_TAGS:=master
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/grpcurl
TITLE:=grpcurl is a command-line tool that lets you interact with gRPC servers
URL:=https://github.com/fullstorydev/grpcurl
SECTION:=net
CATEGORY:=Network
DEPENDS:=$(GO_ARCH_DEPENDS) +protobuf
endef
define Package/grpcurl/description
grpcurl is a command-line tool that lets you interact with gRPC servers. It's basically curl for gRPC servers.
The main purpose for this tool is to invoke RPC methods on a gRPC server from the command-line. gRPC servers use a binary encoding on the wire (protocol buffers, or "protobufs" for short). So they are basically impossible to interact with using regular curl (and older versions of curl that do not support HTTP/2 are of course non-starters). This program accepts messages using JSON encoding, which is much more friendly for both humans and scripts.
endef
define Package/v2ray-core/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/grpcurl $(1)/usr/bin
endef
$(eval $(call GoBinPackage,grpcurl))
$(eval $(call BuildPackage,grpcurl))

View file

@ -88,6 +88,34 @@ elif [ -d /sys/class/net/lan1 -o -n "$(ip link | grep ' lan1')" ] && [ -d /sys/c
lanif="wan"
elif [ -d /sys/class/net/lan ] || [ -n "$(ip link | grep ' lan')" ]; then
lanif="lan"
elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ] && [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.platform' | tr -d '\n')" = "RUTX" ]; then
lanif="eth1"
uci -q batch <<-EOF
set network.@switch_vlan[0]=switch_vlan
set network.@switch_vlan[0].device='switch0'
set network.@switch_vlan[0].vlan=1
set network.@switch_vlan[0].ports='1t 2t 3t 4t 0t'
set network.@switch_vlan[1]=switch_vlan
set network.@switch_vlan[1].device='switch0'
set network.@switch_vlan[1].vlan=1
set network.@switch_vlan[1].ports='5 0'
add network switch_vlan
set network.@switch_vlan[2].device='switch0'
set network.@switch_vlan[2].vlan=3
set network.@switch_vlan[2].ports='0t 1'
add network switch_vlan
set network.@switch_vlan[3].device='switch0'
set network.@switch_vlan[3].vlan=4
set network.@switch_vlan[3].ports='0t 2'
add network switch_vlan
set network.@switch_vlan[4].device='switch0'
set network.@switch_vlan[4].vlan=5
set network.@switch_vlan[4].ports='0t 3'
add network switch_vlan
set network.@switch_vlan[5].device='switch0'
set network.@switch_vlan[5].vlan=6
set network.@switch_vlan[5].ports='0t 4'
EOF
elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ] && [ -d '/sys/class/net/eth1.5' ]; then
lanif="eth1.5"
uci -q batch <<-EOF
@ -131,6 +159,7 @@ set network.lan.proto=static
set network.lan.ipaddr=192.168.100.1
set network.lan.netmask=255.255.255.0
set network.lan.device=${lanif}
set network.lan.ifname=${lanif}
set network.lan.metric=2048
set network.lan.ipv6=0
set network.lan.delegate=0
@ -181,6 +210,11 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ -z "$(uci -q get
_setup_wan_interface wan2 eth0 on macvlan
_setup_macvlan wan1
_setup_macvlan wan2
elif [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.platform' | tr -d '\n')" = "RUTX" ]; then
_setup_wan_interface wan1 eth0.3 master
_setup_wan_interface wan2 eth0.4 on
_setup_wan_interface wan3 eth0.5 on
_setup_wan_interface wan4 eth0.6 on
elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ]; then
_setup_wan_interface wan1 eth0.1 master
_setup_wan_interface wan2 eth0.2 on