mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
Update On Mon Jul 8 20:31:43 CEST 2024
This commit is contained in:
@@ -696,3 +696,4 @@ Update On Thu Jul 4 20:30:48 CEST 2024
|
||||
Update On Fri Jul 5 20:32:45 CEST 2024
|
||||
Update On Sat Jul 6 20:29:28 CEST 2024
|
||||
Update On Sun Jul 7 20:30:22 CEST 2024
|
||||
Update On Mon Jul 8 20:31:33 CEST 2024
|
||||
|
||||
Generated
+2
-2
@@ -413,9 +413,9 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.80"
|
||||
version = "0.1.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
|
||||
checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"i18next": "23.11.5",
|
||||
"jotai": "2.8.4",
|
||||
"monaco-editor": "0.50.0",
|
||||
"mui-color-input": "2.0.3",
|
||||
"mui-color-input": "3.0.0",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-error-boundary": "4.0.13",
|
||||
@@ -60,7 +60,7 @@
|
||||
"clsx": "2.1.1",
|
||||
"react-resizable-panels": "2.0.20",
|
||||
"sass": "1.77.6",
|
||||
"shiki": "1.10.2",
|
||||
"shiki": "1.10.3",
|
||||
"tailwindcss-textshadow": "2.1.3",
|
||||
"vite": "5.3.3",
|
||||
"vite-plugin-monaco-editor": "1.1.3",
|
||||
|
||||
@@ -3,12 +3,14 @@ import { MenuOpen } from "@mui/icons-material";
|
||||
import { Backdrop, IconButton, alpha, useTheme } from "@mui/material";
|
||||
import clsx from "clsx";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import { useState } from "react";
|
||||
import { useCallback, useState } from "react";
|
||||
import { Panel } from "react-resizable-panels";
|
||||
import AnimatedLogo from "../layout/animated-logo";
|
||||
import RouteListItem from "./modules/route-list-item";
|
||||
import { classNames } from "@/utils";
|
||||
import getSystem from "@/utils/get-system";
|
||||
import { useNyanpasu } from "@nyanpasu/interface";
|
||||
import { languageQuirks } from "@/utils/language";
|
||||
|
||||
export const AppDrawer = ({ isDrawer }: { isDrawer?: boolean }) => {
|
||||
const { palette } = useTheme();
|
||||
@@ -17,6 +19,28 @@ export const AppDrawer = ({ isDrawer }: { isDrawer?: boolean }) => {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const { nyanpasuConfig } = useNyanpasu();
|
||||
|
||||
const [onlyIcon, setOnlyIcon] = useState(false);
|
||||
|
||||
const handleResize = useCallback(
|
||||
(value?: number) => {
|
||||
if (value) {
|
||||
if (
|
||||
value <
|
||||
languageQuirks[nyanpasuConfig?.language ?? "en"].drawer.minWidth
|
||||
) {
|
||||
setOnlyIcon(true);
|
||||
} else {
|
||||
setOnlyIcon(false);
|
||||
}
|
||||
} else {
|
||||
setOnlyIcon(false);
|
||||
}
|
||||
},
|
||||
[nyanpasuConfig?.language],
|
||||
);
|
||||
|
||||
const Content = ({ className }: { className?: string }) => {
|
||||
return (
|
||||
<div
|
||||
@@ -35,33 +59,34 @@ export const AppDrawer = ({ isDrawer }: { isDrawer?: boolean }) => {
|
||||
}}
|
||||
data-windrag
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
"flex items-center justify-center gap-4 ",
|
||||
isDrawer && "mx-2",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
isDrawer && "w-10 h-10",
|
||||
"w-full h-full max-w-32 max-h-32 ml-auto mr-auto",
|
||||
)}
|
||||
data-windrag
|
||||
>
|
||||
<div className="flex items-center justify-center gap-4 mx-2">
|
||||
<div className=" h-full max-w-28 max-h-28" data-windrag>
|
||||
<AnimatedLogo className="w-full h-full" data-windrag />
|
||||
</div>
|
||||
|
||||
{isDrawer && (
|
||||
<div className="text-lg text-nowrap font-bold mt-1" data-windrag>
|
||||
Clash Nyanpasu
|
||||
{(isDrawer || !onlyIcon) && (
|
||||
<div
|
||||
className={classNames(
|
||||
"text-lg font-bold mt-1 whitespace-pre-wrap",
|
||||
isDrawer && "mr-1",
|
||||
)}
|
||||
data-windrag
|
||||
>
|
||||
{"Clash\nNyanpasu"}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2 overflow-y-auto scrollbar-hidden">
|
||||
<div className="flex flex-col gap-2 overflow-y-auto scrollbar-hidden !overflow-x-hidden">
|
||||
{Object.entries(routes).map(([name, { path, icon }]) => {
|
||||
return (
|
||||
<RouteListItem key={name} name={name} path={path} icon={icon} />
|
||||
<RouteListItem
|
||||
key={name}
|
||||
name={name}
|
||||
path={path}
|
||||
icon={icon}
|
||||
onlyIcon={!isDrawer && onlyIcon}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@@ -136,7 +161,18 @@ export const AppDrawer = ({ isDrawer }: { isDrawer?: boolean }) => {
|
||||
</Backdrop>
|
||||
</>
|
||||
) : (
|
||||
<Panel id="sidebar" defaultSize={20} order={1} minSize={10}>
|
||||
<Panel
|
||||
id="sidebar"
|
||||
defaultSize={
|
||||
languageQuirks[nyanpasuConfig?.language ?? "en"].drawer.minWidth
|
||||
}
|
||||
order={1}
|
||||
minSize={languageQuirks[nyanpasuConfig?.language ?? "en"].drawer.minWidth}
|
||||
collapsedSize={11}
|
||||
maxSize={36}
|
||||
onResize={handleResize}
|
||||
collapsible
|
||||
>
|
||||
<Content />
|
||||
</Panel>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { classNames } from "@/utils";
|
||||
import { languageQuirks } from "@/utils/language";
|
||||
import { SvgIconComponent } from "@mui/icons-material";
|
||||
import { ListItemButton, ListItemIcon, alpha, useTheme } from "@mui/material";
|
||||
import { useNyanpasu } from "@nyanpasu/interface";
|
||||
import { createElement } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMatch, useNavigate } from "react-router-dom";
|
||||
@@ -8,10 +11,12 @@ export const RouteListItem = ({
|
||||
name,
|
||||
path,
|
||||
icon,
|
||||
onlyIcon,
|
||||
}: {
|
||||
name: string;
|
||||
path: string;
|
||||
icon: SvgIconComponent;
|
||||
onlyIcon?: boolean;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -21,11 +26,17 @@ export const RouteListItem = ({
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { nyanpasuConfig } = useNyanpasu();
|
||||
|
||||
return (
|
||||
<ListItemButton
|
||||
className="!pr-14 !rounded-full"
|
||||
className={classNames(
|
||||
onlyIcon ? "!rounded-3xl !size-16 !mx-auto" : "!pr-14 !rounded-full",
|
||||
)}
|
||||
sx={{
|
||||
backgroundColor: match ? alpha(palette.primary.main, 0.3) : undefined,
|
||||
backgroundColor: match
|
||||
? alpha(palette.primary.main, 0.3)
|
||||
: alpha(palette.background.paper, 0.15),
|
||||
|
||||
"&:hover": {
|
||||
backgroundColor: match ? alpha(palette.primary.main, 0.5) : undefined,
|
||||
@@ -38,15 +49,22 @@ export const RouteListItem = ({
|
||||
sx: {
|
||||
fill: match ? palette.primary.main : undefined,
|
||||
},
|
||||
className: onlyIcon ? "!size-8" : undefined,
|
||||
})}
|
||||
</ListItemIcon>
|
||||
|
||||
<div
|
||||
className="pt-1 pb-1 w-full text-center text-nowrap"
|
||||
style={{ color: match ? palette.primary.main : undefined }}
|
||||
>
|
||||
{t(`label_${name}`)}
|
||||
</div>
|
||||
{!onlyIcon && (
|
||||
<div
|
||||
className={classNames(
|
||||
"pt-1 pb-1 w-full text-nowrap",
|
||||
nyanpasuConfig?.language &&
|
||||
languageQuirks[nyanpasuConfig?.language].drawer.itemClassNames,
|
||||
)}
|
||||
style={{ color: match ? palette.primary.main : undefined }}
|
||||
>
|
||||
{t(`label_${name}`)}
|
||||
</div>
|
||||
)}
|
||||
</ListItemButton>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { languageOptions } from "@/utils/language";
|
||||
import Done from "@mui/icons-material/Done";
|
||||
import { Box, Button, List, ListItem, ListItemText } from "@mui/material";
|
||||
import { useNyanpasu, VergeConfig } from "@nyanpasu/interface";
|
||||
@@ -11,12 +12,6 @@ export const SettingNyanpasuUI = () => {
|
||||
|
||||
const { nyanpasuConfig, setNyanpasuConfig } = useNyanpasu();
|
||||
|
||||
const languageOptions = {
|
||||
zh: "中文",
|
||||
en: "English",
|
||||
ru: "Русский",
|
||||
};
|
||||
|
||||
const themeOptions = {
|
||||
dark: t("theme.dark"),
|
||||
light: t("theme.light"),
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
export const languageOptions = {
|
||||
zh: "中文",
|
||||
en: "English",
|
||||
ru: "Русский",
|
||||
};
|
||||
|
||||
export const languageQuirks: {
|
||||
[key: string]: {
|
||||
drawer: {
|
||||
minWidth: number;
|
||||
itemClassNames?: string;
|
||||
};
|
||||
};
|
||||
} = {
|
||||
zh: {
|
||||
drawer: {
|
||||
minWidth: 22,
|
||||
itemClassNames: "text-center",
|
||||
},
|
||||
},
|
||||
en: {
|
||||
drawer: {
|
||||
minWidth: 26,
|
||||
},
|
||||
},
|
||||
ru: {
|
||||
drawer: {
|
||||
minWidth: 26,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -109,7 +109,7 @@
|
||||
"tsx": "4.16.2",
|
||||
"typescript": "5.5.3"
|
||||
},
|
||||
"packageManager": "pnpm@9.4.0",
|
||||
"packageManager": "pnpm@9.5.0",
|
||||
"engines": {
|
||||
"node": "22.4.0"
|
||||
},
|
||||
|
||||
Generated
+14
-14
@@ -231,8 +231,8 @@ importers:
|
||||
specifier: 0.50.0
|
||||
version: 0.50.0
|
||||
mui-color-input:
|
||||
specifier: 2.0.3
|
||||
version: 2.0.3(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@mui/material@5.16.0(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1)
|
||||
specifier: 3.0.0
|
||||
version: 3.0.0(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@mui/material@5.16.0(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1)
|
||||
react:
|
||||
specifier: npm:react@rc
|
||||
version: 19.0.0-rc-fb9a90fa48-20240614
|
||||
@@ -313,8 +313,8 @@ importers:
|
||||
specifier: 1.77.6
|
||||
version: 1.77.6
|
||||
shiki:
|
||||
specifier: 1.10.2
|
||||
version: 1.10.2
|
||||
specifier: 1.10.3
|
||||
version: 1.10.3
|
||||
tailwindcss-textshadow:
|
||||
specifier: 2.1.3
|
||||
version: 2.1.3
|
||||
@@ -1505,8 +1505,8 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@shikijs/core@1.10.2':
|
||||
resolution: {integrity: sha512-hCtKSC0PNmidU+TVBUiddE0sF1QsOPVbBBRQlugsKy0QJBfSj9aIQQ/pNEIv58wwM/9cAlWG1yihi+5ovZfYmA==}
|
||||
'@shikijs/core@1.10.3':
|
||||
resolution: {integrity: sha512-D45PMaBaeDHxww+EkcDQtDAtzv00Gcsp72ukBtaLSmqRvh0WgGMq3Al0rl1QQBZfuneO75NXMIzEZGFitThWbg==}
|
||||
|
||||
'@sindresorhus/is@4.6.0':
|
||||
resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==}
|
||||
@@ -4172,8 +4172,8 @@ packages:
|
||||
ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
|
||||
mui-color-input@2.0.3:
|
||||
resolution: {integrity: sha512-rAd040qQ0Y+8dk4gE8kkCiJ/vCgA0j4vv1quJ43BfORTFE3uHarHj0xY1Vo9CPbojtx1f5vW+CjckYPRIZPIRg==}
|
||||
mui-color-input@3.0.0:
|
||||
resolution: {integrity: sha512-Qcm72za0yhulZxq13NMnaWFLLoPdZ89JiAmhrRAzXqA26fV0wVDmWpJtNbIMZvancyT4HpKq2ai+7IV9NmZR5g==}
|
||||
peerDependencies:
|
||||
'@emotion/react': ^11.5.0
|
||||
'@emotion/styled': ^11.3.0
|
||||
@@ -4988,8 +4988,8 @@ packages:
|
||||
shell-quote@1.8.1:
|
||||
resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==}
|
||||
|
||||
shiki@1.10.2:
|
||||
resolution: {integrity: sha512-wrddjiCJ6D8zB1MuAGZ37G37rGw+6Ntnqqbl2uXh3P8g5JxneJRRhccPnex/gqorJoXkbpTRC2x54QIsdx2b1Q==}
|
||||
shiki@1.10.3:
|
||||
resolution: {integrity: sha512-eneCLncGuvPdTutJuLyUGS8QNPAVFO5Trvld2wgEq1e002mwctAhJKeMGWtWVXOIEzmlcLRqcgPSorR6AVzOmQ==}
|
||||
|
||||
side-channel@1.0.6:
|
||||
resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==}
|
||||
@@ -6771,7 +6771,7 @@ snapshots:
|
||||
'@rollup/rollup-win32-x64-msvc@4.17.2':
|
||||
optional: true
|
||||
|
||||
'@shikijs/core@1.10.2':
|
||||
'@shikijs/core@1.10.3':
|
||||
dependencies:
|
||||
'@types/hast': 3.0.4
|
||||
|
||||
@@ -9791,7 +9791,7 @@ snapshots:
|
||||
|
||||
ms@2.1.3: {}
|
||||
|
||||
mui-color-input@2.0.3(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@mui/material@5.16.0(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1):
|
||||
mui-color-input@3.0.0(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@mui/material@5.16.0(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1))(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-fb9a90fa48-20240614))(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1):
|
||||
dependencies:
|
||||
'@ctrl/tinycolor': 4.1.0
|
||||
'@emotion/react': 11.11.4(react@19.0.0-rc-fb9a90fa48-20240614)(types-react@19.0.0-rc.1)
|
||||
@@ -10620,9 +10620,9 @@ snapshots:
|
||||
|
||||
shell-quote@1.8.1: {}
|
||||
|
||||
shiki@1.10.2:
|
||||
shiki@1.10.3:
|
||||
dependencies:
|
||||
'@shikijs/core': 1.10.2
|
||||
'@shikijs/core': 1.10.3
|
||||
'@types/hast': 3.0.4
|
||||
|
||||
side-channel@1.0.6:
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
name: Development Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
permissions: write-all
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUST_BACKTRACE: short
|
||||
concurrency:
|
||||
# only allow per workflow per commit (and not pr) to run at a time
|
||||
group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}"
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
dev:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
bundle: nsis
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
bundle: dmg
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
bundle: dmg
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust Stable
|
||||
uses: dtolnay/rust-toolchain@1.77.0
|
||||
|
||||
- name: Add Rust Target
|
||||
run: rustup target add ${{ matrix.target }}
|
||||
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
cache-all-crates: true
|
||||
cache-on-failure: true
|
||||
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Pnpm install and check
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm check ${{ matrix.target }}
|
||||
|
||||
- name: Tauri build
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tauriScript: pnpm
|
||||
args: --target ${{ matrix.target }} -b ${{ matrix.bundle }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
if: matrix.os == 'macos-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.target }}
|
||||
path: src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload Artifacts
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.target }}
|
||||
path: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*.exe
|
||||
if-no-files-found: error
|
||||
+1
-1
@@ -264,6 +264,6 @@ jobs:
|
||||
- name: Submit to Winget
|
||||
uses: vedantmgoyal9/winget-releaser@main
|
||||
with:
|
||||
identifer: ClashVergeRev.ClashVergeRev
|
||||
identifier: ClashVergeRev.ClashVergeRev
|
||||
installers-regex: '_(arm64|x64|x86)-setup\.exe$'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Notice } from "@/components/base";
|
||||
import { nanoid } from "nanoid";
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
import getSystem from "@/utils/get-system";
|
||||
import debounce from "@/utils/debounce";
|
||||
|
||||
import * as monaco from "monaco-editor";
|
||||
import MonacoEditor from "react-monaco-editor";
|
||||
@@ -144,12 +145,19 @@ export const EditorViewer = <T extends Language>(props: Props<T>) => {
|
||||
}
|
||||
});
|
||||
|
||||
const editorResize = debounce(() => {
|
||||
editorRef.current?.layout();
|
||||
setTimeout(() => editorRef.current?.layout(), 500);
|
||||
}, 100);
|
||||
|
||||
useEffect(() => {
|
||||
const unlistenResized = appWindow.onResized(() => {
|
||||
const onResized = debounce(() => {
|
||||
editorResize();
|
||||
appWindow.isMaximized().then((maximized) => {
|
||||
setIsMaximized(() => maximized);
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
const unlistenResized = appWindow.onResized(onResized);
|
||||
|
||||
return () => {
|
||||
unlistenResized.then((fn) => fn());
|
||||
@@ -162,7 +170,13 @@ export const EditorViewer = <T extends Language>(props: Props<T>) => {
|
||||
<Dialog open={open} onClose={onClose} maxWidth="xl" fullWidth>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
|
||||
<DialogContent sx={{ width: "auto", height: "calc(100vh - 185px)" }}>
|
||||
<DialogContent
|
||||
sx={{
|
||||
width: "auto",
|
||||
height: "calc(100vh - 185px)",
|
||||
overflow: "hidden",
|
||||
}}
|
||||
>
|
||||
<MonacoEditor
|
||||
language={language}
|
||||
theme={themeMode === "light" ? "vs" : "vs-dark"}
|
||||
@@ -215,9 +229,7 @@ export const EditorViewer = <T extends Language>(props: Props<T>) => {
|
||||
size="medium"
|
||||
color="inherit"
|
||||
title={t(isMaximized ? "Minimize" : "Maximize")}
|
||||
onClick={() =>
|
||||
appWindow.toggleMaximize().then(() => editorRef.current?.layout())
|
||||
}
|
||||
onClick={() => appWindow.toggleMaximize().then(editorResize)}
|
||||
>
|
||||
{isMaximized ? <CloseFullscreenIcon /> : <OpenInFullIcon />}
|
||||
</IconButton>
|
||||
|
||||
@@ -22,7 +22,14 @@ export const GroupItem = (props: Props) => {
|
||||
let { type, group, onDelete } = props;
|
||||
const sortable = type === "prepend" || type === "append";
|
||||
|
||||
const { attributes, listeners, setNodeRef, transform, transition } = sortable
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = sortable
|
||||
? useSortable({ id: group.name })
|
||||
: {
|
||||
attributes: {},
|
||||
@@ -30,6 +37,7 @@ export const GroupItem = (props: Props) => {
|
||||
setNodeRef: null,
|
||||
transform: null,
|
||||
transition: null,
|
||||
isDragging: false,
|
||||
};
|
||||
|
||||
const [iconCachePath, setIconCachePath] = useState("");
|
||||
@@ -55,6 +63,7 @@ export const GroupItem = (props: Props) => {
|
||||
<ListItem
|
||||
dense
|
||||
sx={({ palette }) => ({
|
||||
position: "relative",
|
||||
background:
|
||||
type === "original"
|
||||
? palette.mode === "dark"
|
||||
@@ -68,6 +77,7 @@ export const GroupItem = (props: Props) => {
|
||||
borderRadius: "8px",
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
zIndex: isDragging ? "calc(infinity)" : undefined,
|
||||
})}
|
||||
>
|
||||
{group.icon && group.icon?.trim().startsWith("http") && (
|
||||
|
||||
@@ -51,8 +51,14 @@ interface Props {
|
||||
export const ProfileItem = (props: Props) => {
|
||||
const { selected, activating, itemData, onSelect, onEdit, onSave, onDelete } =
|
||||
props;
|
||||
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||
useSortable({ id: props.id });
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id: props.id });
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [anchorEl, setAnchorEl] = useState<any>(null);
|
||||
@@ -300,8 +306,10 @@ export const ProfileItem = (props: Props) => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
position: "relative",
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
zIndex: isDragging ? "calc(infinity)" : undefined,
|
||||
}}
|
||||
>
|
||||
<ProfileBox
|
||||
|
||||
@@ -20,7 +20,14 @@ export const ProxyItem = (props: Props) => {
|
||||
let { type, proxy, onDelete } = props;
|
||||
const sortable = type === "prepend" || type === "append";
|
||||
|
||||
const { attributes, listeners, setNodeRef, transform, transition } = sortable
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = sortable
|
||||
? useSortable({ id: proxy.name })
|
||||
: {
|
||||
attributes: {},
|
||||
@@ -28,12 +35,14 @@ export const ProxyItem = (props: Props) => {
|
||||
setNodeRef: null,
|
||||
transform: null,
|
||||
transition: null,
|
||||
isDragging: false,
|
||||
};
|
||||
|
||||
return (
|
||||
<ListItem
|
||||
dense
|
||||
sx={({ palette }) => ({
|
||||
position: "relative",
|
||||
background:
|
||||
type === "original"
|
||||
? palette.mode === "dark"
|
||||
@@ -47,6 +56,7 @@ export const ProxyItem = (props: Props) => {
|
||||
borderRadius: "8px",
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
zIndex: isDragging ? "calc(infinity)" : undefined,
|
||||
})}
|
||||
>
|
||||
<ListItemText
|
||||
|
||||
@@ -24,7 +24,14 @@ export const RuleItem = (props: Props) => {
|
||||
const proxyPolicy = rule.match(/[^,]+$/)?.[0] ?? "";
|
||||
const ruleContent = rule.slice(ruleType.length + 1, -proxyPolicy.length - 1);
|
||||
|
||||
const { attributes, listeners, setNodeRef, transform, transition } = sortable
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = sortable
|
||||
? useSortable({ id: ruleRaw })
|
||||
: {
|
||||
attributes: {},
|
||||
@@ -32,11 +39,13 @@ export const RuleItem = (props: Props) => {
|
||||
setNodeRef: null,
|
||||
transform: null,
|
||||
transition: null,
|
||||
isDragging: false,
|
||||
};
|
||||
return (
|
||||
<ListItem
|
||||
dense
|
||||
sx={({ palette }) => ({
|
||||
position: "relative",
|
||||
background:
|
||||
type === "original"
|
||||
? palette.mode === "dark"
|
||||
@@ -50,6 +59,7 @@ export const RuleItem = (props: Props) => {
|
||||
borderRadius: "8px",
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
zIndex: isDragging ? "calc(infinity)" : undefined,
|
||||
})}
|
||||
>
|
||||
<ListItemText
|
||||
|
||||
@@ -32,8 +32,14 @@ let eventListener: UnlistenFn | null = null;
|
||||
|
||||
export const TestItem = (props: Props) => {
|
||||
const { itemData, onEdit, onDelete: onDeleteItem } = props;
|
||||
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||
useSortable({ id: props.id });
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id: props.id });
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [anchorEl, setAnchorEl] = useState<any>(null);
|
||||
@@ -99,8 +105,10 @@ export const TestItem = (props: Props) => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
position: "relative",
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
zIndex: isDragging ? "calc(infinity)" : undefined,
|
||||
}}
|
||||
>
|
||||
<TestBox
|
||||
|
||||
@@ -133,9 +133,9 @@
|
||||
"Exclude Type": "排除节点类型",
|
||||
"Disable UDP": "禁用UDP",
|
||||
"Hidden": "隐藏代理组",
|
||||
"Extend Config": "扩展配置",
|
||||
"Group Name Required": "代理组名称不能为空",
|
||||
"Group Name Already Exists": "代理组名称已存在",
|
||||
"Extend Config": "扩展配置",
|
||||
"Extend Script": "扩展脚本",
|
||||
"Global Merge": "全局扩展配置",
|
||||
"Global Script": "全局扩展脚本",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
export default function debounce<T extends (...args: any[]) => void>(
|
||||
func: T,
|
||||
wait: number
|
||||
): T {
|
||||
let timeout: ReturnType<typeof setTimeout> | null = null;
|
||||
return function (this: any, ...args: Parameters<T>) {
|
||||
if (timeout !== null) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
timeout = setTimeout(() => func.apply(this, args), wait);
|
||||
} as T;
|
||||
}
|
||||
Vendored
+2
-1
@@ -56,7 +56,8 @@ jobs:
|
||||
|
||||
- name: Build geoip files
|
||||
run: |
|
||||
go run ./
|
||||
go build ./
|
||||
./geoip convert -c ./config.json
|
||||
|
||||
- name: Verify mmdb files
|
||||
run: |
|
||||
|
||||
+57
-30
@@ -227,13 +227,64 @@ These two concepts are notable: `input` and `output`. The `input` is the data so
|
||||
可通过 `go install -v github.com/Loyalsoldier/geoip@latest` 直接安装 CLI。
|
||||
|
||||
```bash
|
||||
$ ./geoip -h
|
||||
Usage of ./geoip:
|
||||
-c string
|
||||
URI of the JSON format config file, support both local file path and remote HTTP(S) URL (default "config.json")
|
||||
-l List all available input and output formats
|
||||
$ ./geoip
|
||||
geoip is a convenient tool to merge, convert and lookup IP & CIDR from various formats of geoip data.
|
||||
|
||||
$ ./geoip -c config.json
|
||||
Usage:
|
||||
geoip [command]
|
||||
|
||||
Available Commands:
|
||||
convert Convert geoip data from one format to another by using config file
|
||||
help Help about any command
|
||||
list List all available input and output formats
|
||||
merge Merge plaintext IP & CIDR from standard input, then print to standard output
|
||||
|
||||
Flags:
|
||||
-h, --help help for geoip
|
||||
|
||||
Use "geoip [command] --help" for more information about a command.
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./geoip list
|
||||
All available input formats:
|
||||
- clashRuleSet (Convert ipcidr type of Clash RuleSet to other formats)
|
||||
- clashRuleSetClassical (Convert classical type of Clash RuleSet to other formats (just processing IP & CIDR lines))
|
||||
- cutter (Remove data from previous steps)
|
||||
- maxmindGeoLite2CountryCSV (Convert MaxMind GeoLite2 country CSV data to other formats)
|
||||
- maxmindMMDB (Convert MaxMind mmdb database to other formats)
|
||||
- private (Convert LAN and private network CIDR to other formats)
|
||||
- singboxSRS (Convert sing-box SRS data to other formats)
|
||||
- stdin (Accept plaintext IP & CIDR from standard input, separated by newline)
|
||||
- surgeRuleSet (Convert Surge RuleSet to other formats (just processing IP & CIDR lines))
|
||||
- test (Convert specific CIDR to other formats (for test only))
|
||||
- text (Convert plaintext IP & CIDR to other formats)
|
||||
- v2rayGeoIPDat (Convert V2Ray GeoIP dat to other formats)
|
||||
|
||||
All available output formats:
|
||||
- clashRuleSet (Convert data to ipcidr type of Clash RuleSet)
|
||||
- clashRuleSetClassical (Convert data to classical type of Clash RuleSet)
|
||||
- maxmindMMDB (Convert data to MaxMind mmdb database format)
|
||||
- singboxSRS (Convert data to sing-box SRS format)
|
||||
- stdout (Convert data to plaintext CIDR format and output to standard output)
|
||||
- surgeRuleSet (Convert data to Surge RuleSet)
|
||||
- text (Convert data to plaintext CIDR format)
|
||||
- v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ curl -s https://core.telegram.org/resources/cidr.txt | ./geoip merge -t ipv4
|
||||
91.105.192.0/23
|
||||
91.108.4.0/22
|
||||
91.108.8.0/21
|
||||
91.108.16.0/21
|
||||
91.108.56.0/22
|
||||
149.154.160.0/20
|
||||
185.76.151.0/24
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./geoip convert -c config.json
|
||||
2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] geoip.dat --> output/dat
|
||||
2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] geoip-only-cn-private.dat --> output/dat
|
||||
2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] geoip-asn.dat --> output/dat
|
||||
@@ -255,30 +306,6 @@ $ ./geoip -c config.json
|
||||
2021/08/29 12:11:45 ✅ [singboxSRS] cloudfront.txt --> output/srs
|
||||
2021/08/29 12:11:45 ✅ [singboxSRS] facebook.txt --> output/srs
|
||||
2021/08/29 12:11:45 ✅ [singboxSRS] fastly.txt --> output/srs
|
||||
|
||||
$ ./geoip -l
|
||||
All available input formats:
|
||||
- v2rayGeoIPDat (Convert V2Ray GeoIP dat to other formats)
|
||||
- maxmindMMDB (Convert MaxMind mmdb database to other formats)
|
||||
- maxmindGeoLite2CountryCSV (Convert MaxMind GeoLite2 country CSV data to other formats)
|
||||
- singboxSRS (Convert sing-box SRS data to other formats)
|
||||
- private (Convert LAN and private network CIDR to other formats)
|
||||
- stdin (Accept plaintext IP & CIDR from standard input, separated by newline)
|
||||
- text (Convert plaintext IP & CIDR to other formats)
|
||||
- clashRuleSetClassical (Convert classical type of Clash RuleSet to other formats (just processing IP & CIDR lines))
|
||||
- clashRuleSet (Convert ipcidr type of Clash RuleSet to other formats)
|
||||
- surgeRuleSet (Convert Surge RuleSet to other formats (just processing IP & CIDR lines))
|
||||
- cutter (Remove data from previous steps)
|
||||
- test (Convert specific CIDR to other formats (for test only))
|
||||
All available output formats:
|
||||
- v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)
|
||||
- maxmindMMDB (Convert data to MaxMind mmdb database format)
|
||||
- singboxSRS (Convert data to sing-box SRS format)
|
||||
- clashRuleSetClassical (Convert data to classical type of Clash RuleSet)
|
||||
- clashRuleSet (Convert data to ipcidr type of Clash RuleSet)
|
||||
- surgeRuleSet (Convert data to Surge RuleSet)
|
||||
- text (Convert data to plaintext CIDR format)
|
||||
- stdout (Convert data to plaintext CIDR format and output to standard output)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(convertCmd)
|
||||
convertCmd.PersistentFlags().StringP("config", "c", "config.json", "URI of the JSON format config file, support both local file path and remote HTTP(S) URL")
|
||||
}
|
||||
|
||||
var convertCmd = &cobra.Command{
|
||||
Use: "convert",
|
||||
Aliases: []string{"conv"},
|
||||
Short: "Convert geoip data from one format to another by using config file",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
configFile, _ := cmd.Flags().GetString("config")
|
||||
log.Println("Use config:", configFile)
|
||||
|
||||
instance, err := lib.NewInstance()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := instance.Init(configFile); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := instance.Run(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
+4
-1
@@ -6,8 +6,9 @@ toolchain go1.21.10
|
||||
|
||||
require (
|
||||
github.com/maxmind/mmdbwriter v1.0.0
|
||||
github.com/oschwald/maxminddb-golang v1.13.0
|
||||
github.com/oschwald/maxminddb-golang v1.13.1
|
||||
github.com/sagernet/sing-box v1.9.3
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/v2fly/v2ray-core/v5 v5.16.1
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
|
||||
google.golang.org/protobuf v1.34.2
|
||||
@@ -17,6 +18,7 @@ require (
|
||||
require (
|
||||
github.com/adrg/xdg v0.4.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/miekg/dns v1.1.59 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
@@ -24,6 +26,7 @@ require (
|
||||
github.com/quic-go/quic-go v0.43.0 // indirect
|
||||
github.com/sagernet/sing v0.4.1 // indirect
|
||||
github.com/sagernet/sing-dns v0.2.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
go.starlark.net v0.0.0-20230612165344-9532f5667272 // indirect
|
||||
golang.org/x/crypto v0.23.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
|
||||
+10
-2
@@ -19,6 +19,7 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@@ -75,6 +76,8 @@ github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a h1:fEBsGL/sjAuJrgah5X
|
||||
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jhump/protoreflect v1.16.0 h1:54fZg+49widqXYQ0b+usAFHbMkBGR4PpXrsHc8+TBDg=
|
||||
github.com/jhump/protoreflect v1.16.0/go.mod h1:oYPd7nPvcBw/5wlDfm/AVmU9zH9BgqGCI469pGxfj/8=
|
||||
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
|
||||
@@ -103,8 +106,8 @@ github.com/onsi/ginkgo/v2 v2.10.0 h1:sfUl4qgLdvkChZrWCYndY2EAu9BRIw1YphNAzy1VNWs
|
||||
github.com/onsi/ginkgo/v2 v2.10.0/go.mod h1:UDQOh5wbQUlMnkLfVaIUMtQ1Vus92oM+P2JX1aulgcE=
|
||||
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
|
||||
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
|
||||
github.com/oschwald/maxminddb-golang v1.13.0 h1:R8xBorY71s84yO06NgTmQvqvTvlS/bnYZrrWX1MElnU=
|
||||
github.com/oschwald/maxminddb-golang v1.13.0/go.mod h1:BU0z8BfFVhi1LQaonTwwGQlsHUEu9pWNdMfmq4ztm0o=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
@@ -134,6 +137,7 @@ github.com/refraction-networking/utls v1.6.5 h1:Jlfqgs/t1Uy6FHHQ8Fz9ZTrRmP/zS7d/
|
||||
github.com/refraction-networking/utls v1.6.5/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
|
||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sagernet/quic-go v0.43.1-beta.2 h1:6YRCE9t1Q3UbNX1/dJGqpwFQbh6DXC6XBrQr2xp6hXY=
|
||||
github.com/sagernet/quic-go v0.43.1-beta.2/go.mod h1:BkrQYeop7Jx3hN3TW8/76CXcdhYiNPyYEBL/BVJ1ifc=
|
||||
github.com/sagernet/sing v0.4.1 h1:zVlpE+7k7AFoC2pv6ReqLf0PIHjihL/jsBl5k05PQFk=
|
||||
@@ -146,6 +150,10 @@ github.com/secure-io/siv-go v0.0.0-20180922214919-5ff40651e2c4 h1:zOjq+1/uLzn/Xo
|
||||
github.com/secure-io/siv-go v0.0.0-20180922214919-5ff40651e2c4/go.mod h1:aI+8yClBW+1uovkHw6HM01YXnYB8vohtB9C83wzx34E=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb h1:XfLJSPIOUX+osiMraVgIrMR27uMXnRJWGm1+GL8/63U=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
|
||||
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func getRemoteURLContent(url string) ([]byte, error) {
|
||||
func GetRemoteURLContent(url string) ([]byte, error) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+17
-1
@@ -26,7 +26,7 @@ func (i *Instance) Init(configFile string) error {
|
||||
var err error
|
||||
configFile = strings.TrimSpace(configFile)
|
||||
if strings.HasPrefix(strings.ToLower(configFile), "http://") || strings.HasPrefix(strings.ToLower(configFile), "https://") {
|
||||
content, err = getRemoteURLContent(configFile)
|
||||
content, err = GetRemoteURLContent(configFile)
|
||||
} else {
|
||||
content, err = os.ReadFile(configFile)
|
||||
}
|
||||
@@ -49,6 +49,22 @@ func (i *Instance) Init(configFile string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *Instance) InitFromBytes(content []byte) error {
|
||||
if err := json.Unmarshal(content, &i.config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, input := range i.config.Input {
|
||||
i.input = append(i.input, input.converter)
|
||||
}
|
||||
|
||||
for _, output := range i.config.Output {
|
||||
i.output = append(i.output, output.converter)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *Instance) Run() error {
|
||||
if len(i.input) == 0 || len(i.output) == 0 {
|
||||
return errors.New("input type and output type must be specified")
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(listCmd)
|
||||
}
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Aliases: []string{"l", "ls"},
|
||||
Short: "List all available input and output formats",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
lib.ListInputConverter()
|
||||
println()
|
||||
lib.ListOutputConverter()
|
||||
},
|
||||
}
|
||||
+9
-24
@@ -1,36 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
list = flag.Bool("l", false, "List all available input and output formats")
|
||||
configFile = flag.String("c", "config.json", "URI of the JSON format config file, support both local file path and remote HTTP(S) URL")
|
||||
)
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "geoip",
|
||||
Short: "geoip is a convenient tool to merge, convert and lookup IP & CIDR from various formats of geoip data.",
|
||||
CompletionOptions: cobra.CompletionOptions{
|
||||
HiddenDefaultCmd: true,
|
||||
},
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if *list {
|
||||
lib.ListInputConverter()
|
||||
lib.ListOutputConverter()
|
||||
return
|
||||
}
|
||||
|
||||
instance, err := lib.NewInstance()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := instance.Init(*configFile); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := instance.Run(); err != nil {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const tempConfig = `
|
||||
{
|
||||
"input": [
|
||||
{
|
||||
"type": "stdin",
|
||||
"action": "add",
|
||||
"args": {
|
||||
"name": "temp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "stdout",
|
||||
"action": "output"
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
||||
const tempConfigWithIPv4 = `
|
||||
{
|
||||
"input": [
|
||||
{
|
||||
"type": "stdin",
|
||||
"action": "add",
|
||||
"args": {
|
||||
"name": "temp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "stdout",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"onlyIPType": "ipv4"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
||||
const tempConfigWithIPv6 = `
|
||||
{
|
||||
"input": [
|
||||
{
|
||||
"type": "stdin",
|
||||
"action": "add",
|
||||
"args": {
|
||||
"name": "temp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "stdout",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"onlyIPType": "ipv6"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(mergeCmd)
|
||||
mergeCmd.PersistentFlags().StringP("onlyiptype", "t", "", "The only IP type to output, available options: \"ipv4\", \"ipv6\"")
|
||||
}
|
||||
|
||||
var mergeCmd = &cobra.Command{
|
||||
Use: "merge",
|
||||
Aliases: []string{"m"},
|
||||
Short: "Merge plaintext IP & CIDR from standard input, then print to standard output",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
otype, _ := cmd.Flags().GetString("onlyiptype")
|
||||
otype = strings.ToLower(strings.TrimSpace(otype))
|
||||
|
||||
if otype != "" && otype != "ipv4" && otype != "ipv6" {
|
||||
log.Fatal("invalid argument onlyiptype: ", otype)
|
||||
}
|
||||
|
||||
var configBytes []byte
|
||||
switch lib.IPType(otype) {
|
||||
case lib.IPv4:
|
||||
configBytes = []byte(tempConfigWithIPv4)
|
||||
case lib.IPv6:
|
||||
configBytes = []byte(tempConfigWithIPv6)
|
||||
default:
|
||||
configBytes = []byte(tempConfig)
|
||||
}
|
||||
|
||||
instance, err := lib.NewInstance()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := instance.InitFromBytes(configBytes); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := instance.Run(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package maxmind
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -20,8 +18,6 @@ const (
|
||||
|
||||
var (
|
||||
defaultMMDBFile = filepath.Join("./", "geolite2", "GeoLite2-Country.mmdb")
|
||||
tempMMDBPath = filepath.Join("./", "tmp")
|
||||
tempMMDBFile = filepath.Join(tempMMDBPath, "input.mmdb")
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -82,26 +78,20 @@ func (g *maxmindMMDBIn) GetDescription() string {
|
||||
}
|
||||
|
||||
func (g *maxmindMMDBIn) Input(container lib.Container) (lib.Container, error) {
|
||||
var fd io.ReadCloser
|
||||
var content []byte
|
||||
var err error
|
||||
switch {
|
||||
case strings.HasPrefix(strings.ToLower(g.URI), "http://"), strings.HasPrefix(strings.ToLower(g.URI), "https://"):
|
||||
fd, err = g.downloadFile(g.URI)
|
||||
content, err = lib.GetRemoteURLContent(g.URI)
|
||||
default:
|
||||
fd, err = os.Open(g.URI)
|
||||
content, err = os.ReadFile(g.URI)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = g.moveFile(fd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
entries := make(map[string]*lib.Entry)
|
||||
err = g.generateEntries(entries)
|
||||
err = g.generateEntries(content, entries)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -149,40 +139,8 @@ func (g *maxmindMMDBIn) Input(container lib.Container) (lib.Container, error) {
|
||||
return container, nil
|
||||
}
|
||||
|
||||
func (g *maxmindMMDBIn) downloadFile(url string) (io.ReadCloser, error) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("failed to get remote file %s, http status code %d", url, resp.StatusCode)
|
||||
}
|
||||
|
||||
return resp.Body, nil
|
||||
}
|
||||
|
||||
func (g *maxmindMMDBIn) moveFile(src io.ReadCloser) error {
|
||||
defer src.Close()
|
||||
|
||||
err := os.MkdirAll(tempMMDBPath, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
out, err := os.Create(tempMMDBFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
_, err = io.Copy(out, src)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (g *maxmindMMDBIn) generateEntries(entries map[string]*lib.Entry) error {
|
||||
db, err := maxminddb.Open(tempMMDBFile)
|
||||
func (g *maxmindMMDBIn) generateEntries(content []byte, entries map[string]*lib.Entry) error {
|
||||
db, err := maxminddb.FromBytes(content)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.15 = .161
|
||||
LINUX_KERNEL_HASH-5.15.161 = d629f78680dc4b65e3d78b61406fb7757b960c83c206e63ad8c2606b3e3c474c
|
||||
LINUX_VERSION-5.15 = .162
|
||||
LINUX_KERNEL_HASH-5.15.162 = 91bfc0ea152ce7b102a0b79d35a7c92843874ebf085c99d2ba8b4d85e62b1a7c
|
||||
|
||||
@@ -27,7 +27,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -4215,12 +4215,10 @@ static irqreturn_t dpni_irq0_handler_thr
|
||||
@@ -4219,12 +4219,10 @@ static irqreturn_t dpni_irq0_handler_thr
|
||||
dpaa2_eth_set_mac_addr(netdev_priv(net_dev));
|
||||
dpaa2_eth_update_tx_fqids(priv);
|
||||
|
||||
@@ -40,7 +40,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
@@ -4516,9 +4514,7 @@ static int dpaa2_eth_remove(struct fsl_m
|
||||
@@ -4520,9 +4518,7 @@ static int dpaa2_eth_remove(struct fsl_m
|
||||
#endif
|
||||
|
||||
unregister_netdev(net_dev);
|
||||
|
||||
@@ -259,7 +259,7 @@ SVN-Revision: 35130
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/icmpv6.h>
|
||||
@@ -944,10 +945,10 @@ static void tcp_v6_send_response(const s
|
||||
@@ -946,10 +947,10 @@ static void tcp_v6_send_response(const s
|
||||
topt = (__be32 *)(t1 + 1);
|
||||
|
||||
if (tsecr) {
|
||||
@@ -337,7 +337,7 @@ SVN-Revision: 35130
|
||||
#endif /* _LINUX_TYPES_H */
|
||||
--- a/net/ipv4/af_inet.c
|
||||
+++ b/net/ipv4/af_inet.c
|
||||
@@ -1480,8 +1480,8 @@ struct sk_buff *inet_gro_receive(struct
|
||||
@@ -1489,8 +1489,8 @@ struct sk_buff *inet_gro_receive(struct
|
||||
if (unlikely(ip_fast_csum((u8 *)iph, 5)))
|
||||
goto out_unlock;
|
||||
|
||||
@@ -751,7 +751,7 @@ SVN-Revision: 35130
|
||||
EXPORT_SYMBOL(xfrm_parse_spi);
|
||||
--- a/net/ipv4/tcp_input.c
|
||||
+++ b/net/ipv4/tcp_input.c
|
||||
@@ -4175,14 +4175,16 @@ static bool tcp_parse_aligned_timestamp(
|
||||
@@ -4192,14 +4192,16 @@ static bool tcp_parse_aligned_timestamp(
|
||||
{
|
||||
const __be32 *ptr = (const __be32 *)(th + 1);
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
struct bmips_quirk {
|
||||
const char *compatible;
|
||||
void (*quirk_fn)(void);
|
||||
@@ -142,17 +181,161 @@ const char *get_system_type(void)
|
||||
@@ -143,17 +182,161 @@ const char *get_system_type(void)
|
||||
return "Generic BMIPS kernel";
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
struct bmips_quirk {
|
||||
const char *compatible;
|
||||
void (*quirk_fn)(void);
|
||||
@@ -340,9 +366,90 @@ void __init plat_time_init(void)
|
||||
@@ -341,9 +367,90 @@ void __init plat_time_init(void)
|
||||
mips_hpt_frequency = freq;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
const struct bmips_quirk *q;
|
||||
|
||||
set_io_port_base(0);
|
||||
@@ -360,6 +467,18 @@ void __init plat_mem_setup(void)
|
||||
@@ -361,6 +468,18 @@ void __init plat_mem_setup(void)
|
||||
|
||||
__dt_setup_arch(dtb);
|
||||
|
||||
|
||||
+3
-3
@@ -45,7 +45,7 @@ Date: Fri Jan 21 11:09:50 2022 +0100
|
||||
int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
|
||||
--- a/net/core/xdp.c
|
||||
+++ b/net/core/xdp.c
|
||||
@@ -409,12 +409,38 @@ static void __xdp_return(void *data, str
|
||||
@@ -407,12 +407,38 @@ static void __xdp_return(void *data, str
|
||||
|
||||
void xdp_return_frame(struct xdp_frame *xdpf)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ Date: Fri Jan 21 11:09:50 2022 +0100
|
||||
__xdp_return(xdpf->data, &xdpf->mem, true, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xdp_return_frame_rx_napi);
|
||||
@@ -450,7 +476,7 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
@@ -448,7 +474,7 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
struct xdp_mem_allocator *xa;
|
||||
|
||||
if (mem->type != MEM_TYPE_PAGE_POOL) {
|
||||
@@ -93,7 +93,7 @@ Date: Fri Jan 21 11:09:50 2022 +0100
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -469,12 +495,38 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
@@ -467,12 +493,38 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
bq->xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1270,7 +1270,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
if (i >= priv->plat->tx_queues_to_use)
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
|
||||
@@ -971,13 +971,13 @@ static int tc_setup_etf(struct stmmac_pr
|
||||
@@ -972,13 +972,13 @@ static int tc_setup_etf(struct stmmac_pr
|
||||
return -EOPNOTSUPP;
|
||||
if (qopt->queue >= priv->plat->tx_queues_to_use)
|
||||
return -EINVAL;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
if (!memcmp(id.base.vendor_name, "ALCATELLUCENT ", 16) &&
|
||||
!memcmp(id.base.vendor_pn, "3FE46541AA ", 16))
|
||||
sfp->module_t_start_up = T_START_UP_BAD_GPON;
|
||||
@@ -2568,6 +2580,8 @@ static int sfp_probe(struct platform_dev
|
||||
@@ -2567,6 +2579,8 @@ static int sfp_probe(struct platform_dev
|
||||
return PTR_ERR(sfp->gpio[i]);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -254,7 +254,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2077,7 +2168,8 @@ static void sfp_sm_module(struct sfp *sf
|
||||
@@ -2076,7 +2167,8 @@ static void sfp_sm_module(struct sfp *sf
|
||||
break;
|
||||
|
||||
/* Report the module insertion to the upstream device */
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/usb/ax88179_178a.c
|
||||
+++ b/drivers/net/usb/ax88179_178a.c
|
||||
@@ -1333,11 +1333,12 @@ static int ax88179_bind(struct usbnet *d
|
||||
@@ -1334,11 +1334,12 @@ static int ax88179_bind(struct usbnet *d
|
||||
dev->mii.phy_id = 0x03;
|
||||
dev->mii.supports_gmii = 1;
|
||||
|
||||
@@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
ax88179_reset(dev);
|
||||
|
||||
@@ -1502,17 +1503,19 @@ ax88179_tx_fixup(struct usbnet *dev, str
|
||||
@@ -1503,17 +1504,19 @@ ax88179_tx_fixup(struct usbnet *dev, str
|
||||
{
|
||||
u32 tx_hdr1, tx_hdr2;
|
||||
int frame_size = dev->maxpacket;
|
||||
@@ -57,7 +57,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
if ((skb_header_cloned(skb) || headroom < 0) &&
|
||||
pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
@@ -1523,6 +1526,8 @@ ax88179_tx_fixup(struct usbnet *dev, str
|
||||
@@ -1524,6 +1527,8 @@ ax88179_tx_fixup(struct usbnet *dev, str
|
||||
put_unaligned_le32(tx_hdr1, ptr);
|
||||
put_unaligned_le32(tx_hdr2, ptr + 4);
|
||||
|
||||
|
||||
+6
-7
@@ -1,10 +1,6 @@
|
||||
From 379ae584cea112db60f4ada79c7e5ba4f3364a64 Mon Sep 17 00:00:00 2001
|
||||
X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
|
||||
X-Patchwork-Id: 13718593
|
||||
X-Patchwork-Delegate: kuba@kernel.org
|
||||
List-Id: <netdev.vger.kernel.org>
|
||||
From 3b2aef99221d395ce37efa426d7b50e7dcd621d6 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Mon, 1 Jul 2024 19:26:28 +0100
|
||||
Date: Mon, 1 Jul 2024 20:28:14 +0100
|
||||
Subject: [PATCH] net: ethernet: mediatek: Allow gaps in MAC allocation
|
||||
|
||||
Some devices with MediaTek SoCs don't use the first but only the second
|
||||
@@ -16,13 +12,16 @@ using 'continue' instead of aborting the loop using 'break'.
|
||||
Fixes: dee4dd10c79a ("net: ethernet: mtk_eth_soc: ppe: add support for multiple PPEs")
|
||||
Suggested-by: Elad Yifee <eladwf@gmail.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
|
||||
Link: https://patch.msgid.link/379ae584cea112db60f4ada79c7e5ba4f3364a64.1719862038.git.daniel@makrotopia.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -3431,7 +3431,7 @@ static int mtk_open(struct net_device *d
|
||||
@@ -3396,7 +3396,7 @@ static int mtk_open(struct net_device *d
|
||||
|
||||
for (i = 0; i < MTK_MAX_DEVS; i++) {
|
||||
if (!eth->netdev[i])
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
From ca18300e00d584d5693127eb60c108b84883b8ac Mon Sep 17 00:00:00 2001
|
||||
From: Shengyu Qu <wiagn233@outlook.com>
|
||||
Date: Fri, 5 Jul 2024 01:26:26 +0800
|
||||
Subject: [PATCH] net: ethernet: mtk_ppe: Change PPE entries number to 16K
|
||||
|
||||
MT7981,7986 and 7988 all supports 32768 PPE entries, and MT7621/MT7620
|
||||
supports 16384 PPE entries, but only set to 8192 entries in driver. So
|
||||
incrase max entries to 16384 instead.
|
||||
|
||||
Signed-off-by: Elad Yifee <eladwf@gmail.com>
|
||||
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/TY3P286MB261103F937DE4EEB0F88437D98DE2@TY3P286MB2611.JPNP286.PROD.OUTLOOK.COM
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/mediatek/mtk_ppe.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/rhashtable.h>
|
||||
|
||||
-#define MTK_PPE_ENTRIES_SHIFT 3
|
||||
+#define MTK_PPE_ENTRIES_SHIFT 4
|
||||
#define MTK_PPE_ENTRIES (1024 << MTK_PPE_ENTRIES_SHIFT)
|
||||
#define MTK_PPE_HASH_MASK (MTK_PPE_ENTRIES - 1)
|
||||
#define MTK_PPE_WAIT_TIMEOUT_US 1000000
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
From 064fbc4e9b5a6dbda7fe7b67dc7e9e95d31f8d75 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 4 Jul 2024 11:14:55 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: implement .{get,set}_pauseparam
|
||||
ethtool ops
|
||||
|
||||
Implement operations to get and set flow-control link parameters.
|
||||
Both is done by simply calling phylink_ethtool_{get,set}_pauseparam().
|
||||
Fix whitespace in mtk_ethtool_ops while at it.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
|
||||
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||
Link: https://patch.msgid.link/e3ece47323444631d6cb479f32af0dfd6d145be0.1720088047.git.daniel@makrotopia.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -4462,6 +4462,20 @@ static int mtk_set_rxnfc(struct net_devi
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static void mtk_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
|
||||
+{
|
||||
+ struct mtk_mac *mac = netdev_priv(dev);
|
||||
+
|
||||
+ phylink_ethtool_get_pauseparam(mac->phylink, pause);
|
||||
+}
|
||||
+
|
||||
+static int mtk_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
|
||||
+{
|
||||
+ struct mtk_mac *mac = netdev_priv(dev);
|
||||
+
|
||||
+ return phylink_ethtool_set_pauseparam(mac->phylink, pause);
|
||||
+}
|
||||
+
|
||||
static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb,
|
||||
struct net_device *sb_dev)
|
||||
{
|
||||
@@ -4490,8 +4504,10 @@ static const struct ethtool_ops mtk_etht
|
||||
.get_strings = mtk_get_strings,
|
||||
.get_sset_count = mtk_get_sset_count,
|
||||
.get_ethtool_stats = mtk_get_ethtool_stats,
|
||||
+ .get_pauseparam = mtk_get_pauseparam,
|
||||
+ .set_pauseparam = mtk_set_pauseparam,
|
||||
.get_rxnfc = mtk_get_rxnfc,
|
||||
- .set_rxnfc = mtk_set_rxnfc,
|
||||
+ .set_rxnfc = mtk_set_rxnfc,
|
||||
};
|
||||
|
||||
static const struct net_device_ops mtk_netdev_ops = {
|
||||
@@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
*/
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -2870,6 +2870,10 @@ static inline int pskb_trim(struct sk_bu
|
||||
@@ -2872,6 +2872,10 @@ static inline int pskb_trim(struct sk_bu
|
||||
return (len < skb->len) ? __pskb_trim(skb, len) : 0;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/**
|
||||
* pskb_trim_unique - remove end from a paged unique (not cloned) buffer
|
||||
* @skb: buffer to alter
|
||||
@@ -3020,16 +3024,6 @@ static inline struct sk_buff *dev_alloc_
|
||||
@@ -3022,16 +3026,6 @@ static inline struct sk_buff *dev_alloc_
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
// Lantech 8330-262D-E can operate at 2500base-X, but
|
||||
// incorrectly report 2500MBd NRZ in their EEPROM
|
||||
.vendor = "Lantech",
|
||||
@@ -2319,7 +2324,8 @@ static void sfp_sm_main(struct sfp *sfp,
|
||||
@@ -2318,7 +2323,8 @@ static void sfp_sm_main(struct sfp *sfp,
|
||||
* or t_start_up, so assume there is a fault.
|
||||
*/
|
||||
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
|
||||
@@ -48,7 +48,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
|
||||
init_done:
|
||||
sfp->sm_phy_retries = R_PHY_RETRY;
|
||||
@@ -2542,10 +2548,12 @@ static void sfp_check_state(struct sfp *
|
||||
@@ -2541,10 +2547,12 @@ static void sfp_check_state(struct sfp *
|
||||
mutex_lock(&sfp->st_mutex);
|
||||
state = sfp_get_state(sfp);
|
||||
changed = state ^ sfp->state;
|
||||
|
||||
@@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/net/core/sock.c
|
||||
+++ b/net/core/sock.c
|
||||
@@ -3900,6 +3900,8 @@ static __net_initdata struct pernet_oper
|
||||
@@ -3894,6 +3894,8 @@ static __net_initdata struct pernet_oper
|
||||
|
||||
static int __init proto_init(void)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -3345,6 +3347,7 @@ static int packet_create(struct net *net
|
||||
@@ -3343,6 +3345,7 @@ static int packet_create(struct net *net
|
||||
mutex_init(&po->pg_vec_lock);
|
||||
po->rollover = NULL;
|
||||
po->prot_hook.func = packet_rcv;
|
||||
@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
if (sock->type == SOCK_PACKET)
|
||||
po->prot_hook.func = packet_rcv_spkt;
|
||||
@@ -3982,6 +3985,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
@@ -3980,6 +3983,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
WRITE_ONCE(po->xmit, val ? packet_direct_xmit : dev_queue_xmit);
|
||||
return 0;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
default:
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
@@ -4038,6 +4051,13 @@ static int packet_getsockopt(struct sock
|
||||
@@ -4036,6 +4049,13 @@ static int packet_getsockopt(struct sock
|
||||
case PACKET_VNET_HDR:
|
||||
val = po->has_vnet_hdr;
|
||||
break;
|
||||
|
||||
@@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -2836,7 +2836,7 @@ static inline int pskb_network_may_pull(
|
||||
@@ -2838,7 +2838,7 @@ static inline int pskb_network_may_pull(
|
||||
* NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
|
||||
*/
|
||||
#ifndef NET_SKB_PAD
|
||||
|
||||
+11
-11
@@ -138,7 +138,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
static const struct rt6_info ip6_blk_hole_entry_template = {
|
||||
.dst = {
|
||||
.__refcnt = ATOMIC_INIT(1),
|
||||
@@ -1034,6 +1048,7 @@ static const int fib6_prop[RTN_MAX + 1]
|
||||
@@ -1036,6 +1050,7 @@ static const int fib6_prop[RTN_MAX + 1]
|
||||
[RTN_BLACKHOLE] = -EINVAL,
|
||||
[RTN_UNREACHABLE] = -EHOSTUNREACH,
|
||||
[RTN_PROHIBIT] = -EACCES,
|
||||
@@ -146,7 +146,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
[RTN_THROW] = -EAGAIN,
|
||||
[RTN_NAT] = -EINVAL,
|
||||
[RTN_XRESOLVE] = -EINVAL,
|
||||
@@ -1069,6 +1084,10 @@ static void ip6_rt_init_dst_reject(struc
|
||||
@@ -1071,6 +1086,10 @@ static void ip6_rt_init_dst_reject(struc
|
||||
rt->dst.output = ip6_pkt_prohibit_out;
|
||||
rt->dst.input = ip6_pkt_prohibit;
|
||||
break;
|
||||
@@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
case RTN_THROW:
|
||||
case RTN_UNREACHABLE:
|
||||
default:
|
||||
@@ -4561,6 +4580,17 @@ static int ip6_pkt_prohibit_out(struct n
|
||||
@@ -4564,6 +4583,17 @@ static int ip6_pkt_prohibit_out(struct n
|
||||
return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
/*
|
||||
* Allocate a dst for local (unicast / anycast) address.
|
||||
*/
|
||||
@@ -5048,7 +5078,8 @@ static int rtm_to_fib6_config(struct sk_
|
||||
@@ -5051,7 +5081,8 @@ static int rtm_to_fib6_config(struct sk_
|
||||
if (rtm->rtm_type == RTN_UNREACHABLE ||
|
||||
rtm->rtm_type == RTN_BLACKHOLE ||
|
||||
rtm->rtm_type == RTN_PROHIBIT ||
|
||||
@@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
cfg->fc_flags |= RTF_REJECT;
|
||||
|
||||
if (rtm->rtm_type == RTN_LOCAL)
|
||||
@@ -6295,6 +6326,8 @@ static int ip6_route_dev_notify(struct n
|
||||
@@ -6298,6 +6329,8 @@ static int ip6_route_dev_notify(struct n
|
||||
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
|
||||
net->ipv6.ip6_prohibit_entry->dst.dev = dev;
|
||||
net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
|
||||
@@ -194,7 +194,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
|
||||
net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
|
||||
#endif
|
||||
@@ -6306,6 +6339,7 @@ static int ip6_route_dev_notify(struct n
|
||||
@@ -6309,6 +6342,7 @@ static int ip6_route_dev_notify(struct n
|
||||
in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev);
|
||||
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
|
||||
in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev);
|
||||
@@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev);
|
||||
#endif
|
||||
}
|
||||
@@ -6497,6 +6531,8 @@ static int __net_init ip6_route_net_init
|
||||
@@ -6500,6 +6534,8 @@ static int __net_init ip6_route_net_init
|
||||
|
||||
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
|
||||
net->ipv6.fib6_has_custom_rules = false;
|
||||
@@ -211,7 +211,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template,
|
||||
sizeof(*net->ipv6.ip6_prohibit_entry),
|
||||
GFP_KERNEL);
|
||||
@@ -6507,11 +6543,21 @@ static int __net_init ip6_route_net_init
|
||||
@@ -6510,11 +6546,21 @@ static int __net_init ip6_route_net_init
|
||||
ip6_template_metrics, true);
|
||||
INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->rt6i_uncached);
|
||||
|
||||
@@ -234,7 +234,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
|
||||
dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
|
||||
ip6_template_metrics, true);
|
||||
@@ -6538,6 +6584,8 @@ out:
|
||||
@@ -6541,6 +6587,8 @@ out:
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
|
||||
@@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
out_ip6_prohibit_entry:
|
||||
kfree(net->ipv6.ip6_prohibit_entry);
|
||||
out_ip6_null_entry:
|
||||
@@ -6557,6 +6605,7 @@ static void __net_exit ip6_route_net_exi
|
||||
@@ -6560,6 +6608,7 @@ static void __net_exit ip6_route_net_exi
|
||||
kfree(net->ipv6.ip6_null_entry);
|
||||
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
|
||||
kfree(net->ipv6.ip6_prohibit_entry);
|
||||
@@ -251,7 +251,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
kfree(net->ipv6.ip6_blk_hole_entry);
|
||||
#endif
|
||||
dst_entries_destroy(&net->ipv6.ip6_dst_ops);
|
||||
@@ -6640,6 +6689,9 @@ void __init ip6_route_init_special_entri
|
||||
@@ -6643,6 +6692,9 @@ void __init ip6_route_init_special_entri
|
||||
init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
|
||||
init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
|
||||
init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
|
||||
|
||||
--- a/net/core/skbuff.c
|
||||
+++ b/net/core/skbuff.c
|
||||
@@ -4371,6 +4371,15 @@ int skb_gro_receive(struct sk_buff *p, s
|
||||
@@ -4395,6 +4395,15 @@ int skb_gro_receive(struct sk_buff *p, s
|
||||
if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
|
||||
return -E2BIG;
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -5020,6 +5020,8 @@ static int mtk_probe(struct platform_dev
|
||||
@@ -5036,6 +5036,8 @@ static int mtk_probe(struct platform_dev
|
||||
* for NAPI to work
|
||||
*/
|
||||
init_dummy_netdev(ð->dummy_dev);
|
||||
|
||||
+7
-7
@@ -510,7 +510,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4554,6 +4701,7 @@ static const struct net_device_ops mtk_n
|
||||
@@ -4570,6 +4717,7 @@ static const struct net_device_ops mtk_n
|
||||
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
||||
{
|
||||
const __be32 *_id = of_get_property(np, "reg", NULL);
|
||||
@@ -518,7 +518,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
phy_interface_t phy_mode;
|
||||
struct phylink *phylink;
|
||||
struct mtk_mac *mac;
|
||||
@@ -4590,16 +4738,41 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
@@ -4606,16 +4754,41 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
mac->id = id;
|
||||
mac->hw = eth;
|
||||
mac->of_node = np;
|
||||
@@ -568,7 +568,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
}
|
||||
|
||||
memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip));
|
||||
@@ -4682,8 +4855,21 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
@@ -4698,8 +4871,21 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
phy_interface_zero(mac->phylink_config.supported_interfaces);
|
||||
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
|
||||
mac->phylink_config.supported_interfaces);
|
||||
@@ -590,7 +590,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
phylink = phylink_create(&mac->phylink_config,
|
||||
of_fwnode_handle(mac->of_node),
|
||||
phy_mode, &mtk_phylink_ops);
|
||||
@@ -4734,6 +4920,26 @@ free_netdev:
|
||||
@@ -4750,6 +4936,26 @@ free_netdev:
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
|
||||
{
|
||||
struct net_device *dev, *tmp;
|
||||
@@ -4880,7 +5086,8 @@ static int mtk_probe(struct platform_dev
|
||||
@@ -4896,7 +5102,8 @@ static int mtk_probe(struct platform_dev
|
||||
regmap_write(cci, 0, 3);
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
err = mtk_sgmii_init(eth);
|
||||
|
||||
if (err)
|
||||
@@ -4991,6 +5198,24 @@ static int mtk_probe(struct platform_dev
|
||||
@@ -5007,6 +5214,24 @@ static int mtk_probe(struct platform_dev
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) {
|
||||
err = devm_request_irq(eth->dev, eth->irq[0],
|
||||
mtk_handle_irq, 0,
|
||||
@@ -5094,6 +5319,11 @@ static int mtk_remove(struct platform_de
|
||||
@@ -5110,6 +5335,11 @@ static int mtk_remove(struct platform_de
|
||||
mtk_stop(eth->netdev[i]);
|
||||
mac = netdev_priv(eth->netdev[i]);
|
||||
phylink_disconnect_phy(mac->phylink);
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
From c6af53f038aa32cec12e8a305ba07c7ef168f1b0 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Tue, 4 Jan 2022 12:07:00 +0000
|
||||
Subject: [PATCH 2/3] net: mdio: add helpers to extract clause 45 regad and
|
||||
devad fields
|
||||
|
||||
Add a couple of helpers and definitions to extract the clause 45 regad
|
||||
and devad fields from the regnum passed into MDIO drivers.
|
||||
|
||||
Tested-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
include/linux/mdio.h | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
--- a/include/linux/mdio.h
|
||||
+++ b/include/linux/mdio.h
|
||||
@@ -7,6 +7,7 @@
|
||||
#define __LINUX_MDIO_H__
|
||||
|
||||
#include <uapi/linux/mdio.h>
|
||||
+#include <linux/bitfield.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
|
||||
/* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit
|
||||
@@ -14,6 +15,7 @@
|
||||
*/
|
||||
#define MII_ADDR_C45 (1<<30)
|
||||
#define MII_DEVADDR_C45_SHIFT 16
|
||||
+#define MII_DEVADDR_C45_MASK GENMASK(20, 16)
|
||||
#define MII_REGADDR_C45_MASK GENMASK(15, 0)
|
||||
|
||||
struct gpio_desc;
|
||||
@@ -355,6 +357,16 @@ static inline u32 mdiobus_c45_addr(int d
|
||||
return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum;
|
||||
}
|
||||
|
||||
+static inline u16 mdiobus_c45_regad(u32 regnum)
|
||||
+{
|
||||
+ return FIELD_GET(MII_REGADDR_C45_MASK, regnum);
|
||||
+}
|
||||
+
|
||||
+static inline u16 mdiobus_c45_devad(u32 regnum)
|
||||
+{
|
||||
+ return FIELD_GET(MII_DEVADDR_C45_MASK, regnum);
|
||||
+}
|
||||
+
|
||||
static inline int __mdiobus_c45_read(struct mii_bus *bus, int prtad, int devad,
|
||||
u16 regnum)
|
||||
{
|
||||
@@ -21,6 +21,7 @@ define Device/EmmcImage
|
||||
IMAGES := factory.bin recovery.bin sysupgrade.bin
|
||||
IMAGE/factory.bin := append-kernel | pad-to 12288k | append-rootfs | append-metadata
|
||||
IMAGE/recovery.bin := append-kernel | pad-to 6144k | append-rootfs | append-metadata
|
||||
IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata
|
||||
endef
|
||||
|
||||
define Device/cmiot_ax18
|
||||
|
||||
+3
-3
@@ -81,7 +81,7 @@ and performance for all other cases.
|
||||
|
||||
--- a/net/ipv4/tcp_input.c
|
||||
+++ b/net/ipv4/tcp_input.c
|
||||
@@ -5388,6 +5388,7 @@ static bool tcp_prune_ofo_queue(struct s
|
||||
@@ -5405,6 +5405,7 @@ static bool tcp_prune_ofo_queue(struct s
|
||||
static int tcp_prune_queue(struct sock *sk)
|
||||
{
|
||||
struct tcp_sock *tp = tcp_sk(sk);
|
||||
@@ -89,7 +89,7 @@ and performance for all other cases.
|
||||
|
||||
NET_INC_STATS(sock_net(sk), LINUX_MIB_PRUNECALLED);
|
||||
|
||||
@@ -5399,6 +5400,39 @@ static int tcp_prune_queue(struct sock *
|
||||
@@ -5416,6 +5417,39 @@ static int tcp_prune_queue(struct sock *
|
||||
if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf)
|
||||
return 0;
|
||||
|
||||
@@ -129,7 +129,7 @@ and performance for all other cases.
|
||||
tcp_collapse_ofo_queue(sk);
|
||||
if (!skb_queue_empty(&sk->sk_receive_queue))
|
||||
tcp_collapse(sk, &sk->sk_receive_queue, NULL,
|
||||
@@ -5418,6 +5452,8 @@ static int tcp_prune_queue(struct sock *
|
||||
@@ -5435,6 +5469,8 @@ static int tcp_prune_queue(struct sock *
|
||||
if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Language: ar\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/system/filebrowser.js:16
|
||||
#: applications/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3
|
||||
msgid "File Browser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3
|
||||
msgid "Grant access to File Browser"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,14 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Language: sk\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/system/filebrowser.js:16
|
||||
#: applications/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3
|
||||
msgid "File Browser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3
|
||||
msgid "Grant access to File Browser"
|
||||
msgstr ""
|
||||
@@ -11,7 +11,7 @@ LUCI_DEPENDS:=+curl +opkg +luci-base +tar +coreutils +coreutils-stat +libuci-lua
|
||||
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.19)
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=0.1.24-0
|
||||
PKG_VERSION:=0.1.24-1
|
||||
# PKG_RELEASE MUST be empty for luci.mk
|
||||
PKG_RELEASE:=
|
||||
|
||||
|
||||
@@ -222,6 +222,15 @@ try_autoconf() {
|
||||
/usr/libexec/istorea/${ISTORE_AUTOCONF}.sh
|
||||
}
|
||||
|
||||
try_upgrade_depends() {
|
||||
local pkg="$1"
|
||||
if [[ $pkg == app-meta-* ]]; then
|
||||
local deps=$(grep '^Depends: ' /usr/lib/opkg/info/$pkg.control | busybox sed -e 's/^Depends: //' -e 's/,/\n/g' -e 's/ //g' | grep -vFw libc | xargs echo)
|
||||
[ -z "$deps" ] || opkg_wrap_mirrors install $deps
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: is-opkg sub-command [arguments...]"
|
||||
echo "where sub-command is one of:"
|
||||
@@ -245,7 +254,7 @@ case $action in
|
||||
;;
|
||||
"install")
|
||||
check_space
|
||||
wrapped_in_update opkg_wrap_mirrors install "$@" && try_autoconf
|
||||
wrapped_in_update opkg_wrap_mirrors install "$@" && try_upgrade_depends "$1" && try_autoconf
|
||||
;;
|
||||
"autoconf")
|
||||
try_autoconf
|
||||
|
||||
@@ -215,7 +215,7 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/ResponseStoreCheckSelfUpgrade"
|
||||
$ref: "#/definitions/ResponseStoreGetBlockDevices"
|
||||
/cgi-bin/luci/admin/store/configured:
|
||||
get:
|
||||
tags:
|
||||
@@ -460,6 +460,29 @@ definitions:
|
||||
error:
|
||||
type: string
|
||||
description: "当result为bad时,此处返回错误日志"
|
||||
StoreEntrysh:
|
||||
type: object
|
||||
description: "状态和入口信息,不同插件可能有些不一样,仅列出常用公共参数"
|
||||
properties:
|
||||
app:
|
||||
type: string
|
||||
description: "插件名称"
|
||||
docker:
|
||||
type: boolean
|
||||
description: "如果是docker插件"
|
||||
running:
|
||||
type: boolean
|
||||
description: "是否运行中"
|
||||
deployed:
|
||||
type: boolean
|
||||
description: "如果是docker插件且未运行,则是否已经部署"
|
||||
web:
|
||||
type: string
|
||||
description: "url"
|
||||
href:
|
||||
type: string
|
||||
description: "web端直接跳转url"
|
||||
|
||||
ResponseStoreEntrysh:
|
||||
type: object
|
||||
properties:
|
||||
@@ -470,27 +493,7 @@ definitions:
|
||||
description: "处理成功的结果集"
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
description: "状态和入口信息,不同插件可能有些不一样,仅列出常用公共参数"
|
||||
properties:
|
||||
app:
|
||||
type: string
|
||||
description: "插件名称"
|
||||
docker:
|
||||
type: boolean
|
||||
description: "如果是docker插件"
|
||||
running:
|
||||
type: boolean
|
||||
description: "是否运行中"
|
||||
deployed:
|
||||
type: boolean
|
||||
description: "如果是docker插件且未运行,则是否已经部署"
|
||||
web:
|
||||
type: string
|
||||
description: "url"
|
||||
href:
|
||||
type: string
|
||||
description: "web端直接跳转url"
|
||||
$ref: "#/definitions/StoreEntrysh"
|
||||
errors:
|
||||
description: "处理失败的结果集"
|
||||
type: array
|
||||
|
||||
@@ -29,7 +29,14 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
lock (queueLock)
|
||||
{
|
||||
_pool = new CommandBufferPool(_gd.Api, _device, queue, queueLock, _gd.QueueFamilyIndex, isLight: true);
|
||||
_pool = new CommandBufferPool(
|
||||
_gd.Api,
|
||||
_device,
|
||||
queue,
|
||||
queueLock,
|
||||
_gd.QueueFamilyIndex,
|
||||
_gd.IsConcurrentFenceWaitUnsupported,
|
||||
isLight: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
private readonly Device _device;
|
||||
private readonly Queue _queue;
|
||||
private readonly object _queueLock;
|
||||
private readonly bool _concurrentFenceWaitUnsupported;
|
||||
private readonly CommandPool _pool;
|
||||
private readonly Thread _owner;
|
||||
|
||||
@@ -61,12 +62,20 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
private int _queuedCount;
|
||||
private int _inUseCount;
|
||||
|
||||
public unsafe CommandBufferPool(Vk api, Device device, Queue queue, object queueLock, uint queueFamilyIndex, bool isLight = false)
|
||||
public unsafe CommandBufferPool(
|
||||
Vk api,
|
||||
Device device,
|
||||
Queue queue,
|
||||
object queueLock,
|
||||
uint queueFamilyIndex,
|
||||
bool concurrentFenceWaitUnsupported,
|
||||
bool isLight = false)
|
||||
{
|
||||
_api = api;
|
||||
_device = device;
|
||||
_queue = queue;
|
||||
_queueLock = queueLock;
|
||||
_concurrentFenceWaitUnsupported = concurrentFenceWaitUnsupported;
|
||||
_owner = Thread.CurrentThread;
|
||||
|
||||
var commandPoolCreateInfo = new CommandPoolCreateInfo
|
||||
@@ -357,7 +366,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
if (refreshFence)
|
||||
{
|
||||
entry.Fence = new FenceHolder(_api, _device);
|
||||
entry.Fence = new FenceHolder(_api, _device, _concurrentFenceWaitUnsupported);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -73,7 +73,6 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
private readonly VulkanRenderer _gd;
|
||||
private readonly Device _device;
|
||||
private readonly PipelineBase _pipeline;
|
||||
private ShaderCollection _program;
|
||||
|
||||
private readonly BufferRef[] _uniformBufferRefs;
|
||||
@@ -125,11 +124,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
private readonly TextureView _dummyTexture;
|
||||
private readonly SamplerHolder _dummySampler;
|
||||
|
||||
public DescriptorSetUpdater(VulkanRenderer gd, Device device, PipelineBase pipeline)
|
||||
public DescriptorSetUpdater(VulkanRenderer gd, Device device)
|
||||
{
|
||||
_gd = gd;
|
||||
_device = device;
|
||||
_pipeline = pipeline;
|
||||
|
||||
// Some of the bindings counts needs to be multiplied by 2 because we have buffer and
|
||||
// regular textures/images interleaved on the same descriptor set.
|
||||
@@ -684,7 +682,14 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
if (_dirty.HasFlag(DirtyFlags.Texture))
|
||||
{
|
||||
UpdateAndBind(cbs, program, PipelineBase.TextureSetIndex, pbp);
|
||||
if (program.UpdateTexturesWithoutTemplate)
|
||||
{
|
||||
UpdateAndBindTexturesWithoutTemplate(cbs, program, pbp);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateAndBind(cbs, program, PipelineBase.TextureSetIndex, pbp);
|
||||
}
|
||||
}
|
||||
|
||||
if (_dirty.HasFlag(DirtyFlags.Image))
|
||||
@@ -918,31 +923,84 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
_gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan<uint>.Empty);
|
||||
}
|
||||
|
||||
private unsafe void UpdateBuffers(
|
||||
CommandBufferScoped cbs,
|
||||
PipelineBindPoint pbp,
|
||||
int baseBinding,
|
||||
ReadOnlySpan<DescriptorBufferInfo> bufferInfo,
|
||||
DescriptorType type)
|
||||
private void UpdateAndBindTexturesWithoutTemplate(CommandBufferScoped cbs, ShaderCollection program, PipelineBindPoint pbp)
|
||||
{
|
||||
if (bufferInfo.Length == 0)
|
||||
int setIndex = PipelineBase.TextureSetIndex;
|
||||
var bindingSegments = program.BindingSegments[setIndex];
|
||||
|
||||
if (bindingSegments.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo)
|
||||
if (_updateDescriptorCacheCbIndex)
|
||||
{
|
||||
var writeDescriptorSet = new WriteDescriptorSet
|
||||
{
|
||||
SType = StructureType.WriteDescriptorSet,
|
||||
DstBinding = (uint)baseBinding,
|
||||
DescriptorType = type,
|
||||
DescriptorCount = (uint)bufferInfo.Length,
|
||||
PBufferInfo = pBufferInfo,
|
||||
};
|
||||
|
||||
_gd.PushDescriptorApi.CmdPushDescriptorSet(cbs.CommandBuffer, pbp, _program.PipelineLayout, 0, 1, &writeDescriptorSet);
|
||||
_updateDescriptorCacheCbIndex = false;
|
||||
program.UpdateDescriptorCacheCommandBufferIndex(cbs.CommandBufferIndex);
|
||||
}
|
||||
|
||||
var dsc = program.GetNewDescriptorSetCollection(setIndex, out _).Get(cbs);
|
||||
|
||||
foreach (ResourceBindingSegment segment in bindingSegments)
|
||||
{
|
||||
int binding = segment.Binding;
|
||||
int count = segment.Count;
|
||||
|
||||
if (!segment.IsArray)
|
||||
{
|
||||
if (segment.Type != ResourceType.BufferTexture)
|
||||
{
|
||||
Span<DescriptorImageInfo> textures = _textures;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ref var texture = ref textures[i];
|
||||
ref var refs = ref _textureRefs[binding + i];
|
||||
|
||||
texture.ImageView = refs.View?.Get(cbs).Value ?? default;
|
||||
texture.Sampler = refs.Sampler?.Get(cbs).Value ?? default;
|
||||
|
||||
if (texture.ImageView.Handle == 0)
|
||||
{
|
||||
texture.ImageView = _dummyTexture.GetImageView().Get(cbs).Value;
|
||||
}
|
||||
|
||||
if (texture.Sampler.Handle == 0)
|
||||
{
|
||||
texture.Sampler = _dummySampler.GetSampler().Get(cbs).Value;
|
||||
}
|
||||
}
|
||||
|
||||
dsc.UpdateImages(0, binding, textures[..count], DescriptorType.CombinedImageSampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
Span<BufferView> bufferTextures = _bufferTextures;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
bufferTextures[i] = _bufferTextureRefs[binding + i]?.GetBufferView(cbs, false) ?? default;
|
||||
}
|
||||
|
||||
dsc.UpdateBufferImages(0, binding, bufferTextures[..count], DescriptorType.UniformTexelBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (segment.Type != ResourceType.BufferTexture)
|
||||
{
|
||||
dsc.UpdateImages(0, binding, _textureArrayRefs[binding].Array.GetImageInfos(_gd, cbs, _dummyTexture, _dummySampler), DescriptorType.CombinedImageSampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsc.UpdateBufferImages(0, binding, _textureArrayRefs[binding].Array.GetBufferViews(cbs), DescriptorType.UniformTexelBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sets = dsc.GetSets();
|
||||
|
||||
_gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan<uint>.Empty);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
@@ -10,12 +10,15 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
private readonly Device _device;
|
||||
private Fence _fence;
|
||||
private int _referenceCount;
|
||||
private int _lock;
|
||||
private readonly bool _concurrentWaitUnsupported;
|
||||
private bool _disposed;
|
||||
|
||||
public unsafe FenceHolder(Vk api, Device device)
|
||||
public unsafe FenceHolder(Vk api, Device device, bool concurrentWaitUnsupported)
|
||||
{
|
||||
_api = api;
|
||||
_device = device;
|
||||
_concurrentWaitUnsupported = concurrentWaitUnsupported;
|
||||
|
||||
var fenceCreateInfo = new FenceCreateInfo
|
||||
{
|
||||
@@ -47,6 +50,11 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
}
|
||||
while (Interlocked.CompareExchange(ref _referenceCount, lastValue + 1, lastValue) != lastValue);
|
||||
|
||||
if (_concurrentWaitUnsupported)
|
||||
{
|
||||
AcquireLock();
|
||||
}
|
||||
|
||||
fence = _fence;
|
||||
return true;
|
||||
}
|
||||
@@ -57,6 +65,16 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
return _fence;
|
||||
}
|
||||
|
||||
public void PutLock()
|
||||
{
|
||||
Put();
|
||||
|
||||
if (_concurrentWaitUnsupported)
|
||||
{
|
||||
ReleaseLock();
|
||||
}
|
||||
}
|
||||
|
||||
public void Put()
|
||||
{
|
||||
if (Interlocked.Decrement(ref _referenceCount) == 0)
|
||||
@@ -66,24 +84,67 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
}
|
||||
}
|
||||
|
||||
private void AcquireLock()
|
||||
{
|
||||
while (!TryAcquireLock())
|
||||
{
|
||||
Thread.SpinWait(32);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryAcquireLock()
|
||||
{
|
||||
return Interlocked.Exchange(ref _lock, 1) == 0;
|
||||
}
|
||||
|
||||
private void ReleaseLock()
|
||||
{
|
||||
Interlocked.Exchange(ref _lock, 0);
|
||||
}
|
||||
|
||||
public void Wait()
|
||||
{
|
||||
Span<Fence> fences = stackalloc Fence[]
|
||||
if (_concurrentWaitUnsupported)
|
||||
{
|
||||
_fence,
|
||||
};
|
||||
AcquireLock();
|
||||
|
||||
FenceHelper.WaitAllIndefinitely(_api, _device, fences);
|
||||
try
|
||||
{
|
||||
FenceHelper.WaitAllIndefinitely(_api, _device, stackalloc Fence[] { _fence });
|
||||
}
|
||||
finally
|
||||
{
|
||||
ReleaseLock();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FenceHelper.WaitAllIndefinitely(_api, _device, stackalloc Fence[] { _fence });
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSignaled()
|
||||
{
|
||||
Span<Fence> fences = stackalloc Fence[]
|
||||
if (_concurrentWaitUnsupported)
|
||||
{
|
||||
_fence,
|
||||
};
|
||||
if (!TryAcquireLock())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return FenceHelper.AllSignaled(_api, _device, fences);
|
||||
try
|
||||
{
|
||||
return FenceHelper.AllSignaled(_api, _device, stackalloc Fence[] { _fence });
|
||||
}
|
||||
finally
|
||||
{
|
||||
ReleaseLock();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return FenceHelper.AllSignaled(_api, _device, stackalloc Fence[] { _fence });
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -196,18 +196,23 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
bool signaled = true;
|
||||
|
||||
if (hasTimeout)
|
||||
try
|
||||
{
|
||||
signaled = FenceHelper.AllSignaled(api, device, fences[..fenceCount], timeout);
|
||||
if (hasTimeout)
|
||||
{
|
||||
signaled = FenceHelper.AllSignaled(api, device, fences[..fenceCount], timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
FenceHelper.WaitAllIndefinitely(api, device, fences[..fenceCount]);
|
||||
}
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
FenceHelper.WaitAllIndefinitely(api, device, fences[..fenceCount]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < fenceCount; i++)
|
||||
{
|
||||
fenceHolders[i].Put();
|
||||
for (int i = 0; i < fenceCount; i++)
|
||||
{
|
||||
fenceHolders[i].PutLock();
|
||||
}
|
||||
}
|
||||
|
||||
return signaled;
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
gd.Api.CreatePipelineCache(device, pipelineCacheCreateInfo, null, out PipelineCache).ThrowOnError();
|
||||
|
||||
_descriptorSetUpdater = new DescriptorSetUpdater(gd, device, this);
|
||||
_descriptorSetUpdater = new DescriptorSetUpdater(gd, device);
|
||||
_vertexBufferUpdater = new VertexBufferUpdater(gd);
|
||||
|
||||
_transformFeedbackBuffers = new BufferState[Constants.MaxTransformFeedbackBuffers];
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
public bool IsCompute { get; }
|
||||
public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0;
|
||||
|
||||
public bool UpdateTexturesWithoutTemplate { get; }
|
||||
|
||||
public uint Stages { get; }
|
||||
|
||||
public ResourceBindingSegment[][] ClearSegments { get; }
|
||||
@@ -127,9 +129,12 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
Stages = stages;
|
||||
|
||||
ClearSegments = BuildClearSegments(sets);
|
||||
BindingSegments = BuildBindingSegments(resourceLayout.SetUsages);
|
||||
BindingSegments = BuildBindingSegments(resourceLayout.SetUsages, out bool usesBufferTextures);
|
||||
Templates = BuildTemplates(usePushDescriptors);
|
||||
|
||||
// Updating buffer texture bindings using template updates crashes the Adreno driver on Windows.
|
||||
UpdateTexturesWithoutTemplate = gd.Vendor == Vendor.Qualcomm && usesBufferTextures;
|
||||
|
||||
_compileTask = Task.CompletedTask;
|
||||
_firstBackgroundUse = false;
|
||||
}
|
||||
@@ -280,8 +285,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
return segments;
|
||||
}
|
||||
|
||||
private static ResourceBindingSegment[][] BuildBindingSegments(ReadOnlyCollection<ResourceUsageCollection> setUsages)
|
||||
private static ResourceBindingSegment[][] BuildBindingSegments(ReadOnlyCollection<ResourceUsageCollection> setUsages, out bool usesBufferTextures)
|
||||
{
|
||||
usesBufferTextures = false;
|
||||
|
||||
ResourceBindingSegment[][] segments = new ResourceBindingSegment[setUsages.Count][];
|
||||
|
||||
for (int setIndex = 0; setIndex < setUsages.Count; setIndex++)
|
||||
@@ -295,6 +302,11 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
ResourceUsage usage = setUsages[setIndex].Usages[index];
|
||||
|
||||
if (usage.Type == ResourceType.BufferTexture)
|
||||
{
|
||||
usesBufferTextures = true;
|
||||
}
|
||||
|
||||
if (currentUsage.Binding + currentCount != usage.Binding ||
|
||||
currentUsage.Type != usage.Type ||
|
||||
currentUsage.Stages != usage.Stages ||
|
||||
|
||||
@@ -90,6 +90,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
internal bool IsMoltenVk { get; private set; }
|
||||
internal bool IsTBDR { get; private set; }
|
||||
internal bool IsSharedMemory { get; private set; }
|
||||
internal bool IsConcurrentFenceWaitUnsupported { get; private set; }
|
||||
|
||||
public string GpuVendor { get; private set; }
|
||||
public string GpuDriver { get; private set; }
|
||||
public string GpuRenderer { get; private set; }
|
||||
@@ -323,6 +325,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
Vendor == Vendor.Broadcom ||
|
||||
Vendor == Vendor.ImgTec;
|
||||
|
||||
IsConcurrentFenceWaitUnsupported = Vendor == Vendor.Qualcomm;
|
||||
|
||||
GpuVendor = VendorUtils.GetNameFromId(properties.VendorID);
|
||||
GpuDriver = hasDriverProperties && !OperatingSystem.IsMacOS() ?
|
||||
VendorUtils.GetFriendlyDriverName(driverProperties.DriverID) : GpuVendor; // Fallback to vendor name if driver is unavailable or on MacOS where vendor is preferred.
|
||||
@@ -411,7 +415,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
Api.TryGetDeviceExtension(_instance.Instance, _device, out ExtExternalMemoryHost hostMemoryApi);
|
||||
HostMemoryAllocator = new HostMemoryAllocator(MemoryAllocator, Api, hostMemoryApi, _device);
|
||||
|
||||
CommandBufferPool = new CommandBufferPool(Api, _device, Queue, QueueLock, queueFamilyIndex);
|
||||
CommandBufferPool = new CommandBufferPool(Api, _device, Queue, QueueLock, queueFamilyIndex, IsConcurrentFenceWaitUnsupported);
|
||||
|
||||
PipelineLayoutCache = new PipelineLayoutCache();
|
||||
|
||||
|
||||
@@ -623,7 +623,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
public override void SetSize(int width, int height)
|
||||
{
|
||||
// Not needed as we can get the size from the surface.
|
||||
// We don't need to use width and height as we can get the size from the surface.
|
||||
_swapchainIsDirty = true;
|
||||
}
|
||||
|
||||
public override void ChangeVSyncMode(bool vsyncEnabled)
|
||||
|
||||
Generated
+13
-13
@@ -210,9 +210,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.80"
|
||||
version = "0.1.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
|
||||
checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1428,9 +1428,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.3.1"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
|
||||
checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
@@ -1665,9 +1665,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44a986806a1cc899952ba462bc1f28afbfd5850ab6cb030ccb20dd02cc527a24"
|
||||
checksum = "bd69211b9b519e98303c015e21a007e293db403b6c85b9b124e133d25e242cdd"
|
||||
dependencies = [
|
||||
"icu_normalizer",
|
||||
"icu_properties",
|
||||
@@ -2467,9 +2467,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "qrcode"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23e719ca51966ff9f5a8436edb00d6115b3c606a0bb27c8f8ca74a38ff2b036d"
|
||||
checksum = "d68782463e408eb1e668cf6152704bd856c78c5b6417adaee3203d8f4c1fc9ec"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
@@ -3285,7 +3285,7 @@ dependencies = [
|
||||
"http-body-util",
|
||||
"httparse",
|
||||
"hyper",
|
||||
"idna 1.0.1",
|
||||
"idna 1.0.2",
|
||||
"ipnet",
|
||||
"iprange",
|
||||
"json5",
|
||||
@@ -3516,9 +3516,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sysexits"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aaeada5433f30b34f25f70784cfc22b05d06a32eaa7e598b1433ecffb27e9499"
|
||||
checksum = "c4008983d29e823b1415f5f12732d5c9a44059795fb6218262cc0185668851e2"
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
@@ -4504,9 +4504,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.13.1"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a"
|
||||
checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9"
|
||||
dependencies = [
|
||||
"zstd-safe",
|
||||
]
|
||||
|
||||
@@ -167,7 +167,7 @@ async-trait = "0.1"
|
||||
socket2 = { version = "0.5", features = ["all"] }
|
||||
libc = "0.2.141"
|
||||
|
||||
hyper = { version = "1.3", optional = true, features = ["full"] }
|
||||
hyper = { version = "1.4", optional = true, features = ["full"] }
|
||||
http-body-util = { version = "0.1", optional = true }
|
||||
http = { version = "1.1", optional = true }
|
||||
httparse = { version = "1.9", optional = true }
|
||||
|
||||
@@ -21,22 +21,22 @@ define Download/geoip
|
||||
HASH:=c55f7e9866acb963873b0d907404b395bd3b7447470b5407d79868c3d1c0cb04
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=20240624143214
|
||||
GEOSITE_VER:=20240708041141
|
||||
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
|
||||
define Download/geosite
|
||||
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=2542bbc017ae060da37260da02f7567fb2b016f0e825aee5c23b1e8567c0649e
|
||||
HASH:=0f6b618816647432f5d6d5b8c4a424cc5258864c6c9d54ffeca9730404939ab4
|
||||
endef
|
||||
|
||||
GEOSITE_IRAN_VER:=202407010032
|
||||
GEOSITE_IRAN_VER:=202407080029
|
||||
GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER)
|
||||
define Download/geosite-ir
|
||||
URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/
|
||||
URL_FILE:=iran.dat
|
||||
FILE:=$(GEOSITE_IRAN_FILE)
|
||||
HASH:=1306992448a10f1e1c0c0a566c0bb6057e999a0029bb1004b17763299013b893
|
||||
HASH:=d3c6bd7daab2c720c4c9796c3b31ee7328273cc52b9ff6621e63c5e0513f9a49
|
||||
endef
|
||||
|
||||
define Package/v2ray-geodata/template
|
||||
|
||||
+44
-15
@@ -1,10 +1,38 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using static v2rayN.Handler.ProxySetting.InternetConnectionOption;
|
||||
using static v2rayN.Common.ProxySetting.InternetConnectionOption;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace v2rayN.Common
|
||||
{
|
||||
internal class ProxySetting
|
||||
{
|
||||
private const string _regPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
|
||||
|
||||
private static bool SetProxyFallback(string? strProxy, string? exceptions, int type)
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
Utils.RegWriteValue(_regPath, "ProxyEnable", 0);
|
||||
Utils.RegWriteValue(_regPath, "ProxyServer", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "ProxyOverride", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "AutoConfigURL", string.Empty);
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
Utils.RegWriteValue(_regPath, "ProxyEnable", 1);
|
||||
Utils.RegWriteValue(_regPath, "ProxyServer", strProxy ?? string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "ProxyOverride", exceptions ?? string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "AutoConfigURL", string.Empty);
|
||||
}
|
||||
else if (type == 4)
|
||||
{
|
||||
Utils.RegWriteValue(_regPath, "ProxyEnable", 0);
|
||||
Utils.RegWriteValue(_regPath, "ProxyServer", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "ProxyOverride", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "AutoConfigURL", strProxy ?? string.Empty);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
// set to use no proxy
|
||||
/// </summary>
|
||||
@@ -43,6 +71,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetProxyFallback(strProxy, exceptions, type);
|
||||
Logging.SaveLog(ex.Message, ex);
|
||||
return false;
|
||||
}
|
||||
@@ -102,25 +131,25 @@ namespace v2rayN.Handler
|
||||
}
|
||||
else
|
||||
{
|
||||
list.szConnection = IntPtr.Zero;
|
||||
list.szConnection = nint.Zero;
|
||||
}
|
||||
list.dwOptionCount = options.Length;
|
||||
list.dwOptionError = 0;
|
||||
|
||||
int optSize = Marshal.SizeOf(typeof(InternetConnectionOption));
|
||||
// make a pointer out of all that ...
|
||||
IntPtr optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length); // !! remember to deallocate memory 4
|
||||
nint optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length); // !! remember to deallocate memory 4
|
||||
// copy the array over into that spot in memory ...
|
||||
for (int i = 0; i < options.Length; ++i)
|
||||
{
|
||||
if (Environment.Is64BitOperatingSystem)
|
||||
{
|
||||
IntPtr opt = new(optionsPtr.ToInt64() + (i * optSize));
|
||||
nint opt = new(optionsPtr.ToInt64() + i * optSize);
|
||||
Marshal.StructureToPtr(options[i], opt, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
IntPtr opt = new(optionsPtr.ToInt32() + (i * optSize));
|
||||
nint opt = new(optionsPtr.ToInt32() + i * optSize);
|
||||
Marshal.StructureToPtr(options[i], opt, false);
|
||||
}
|
||||
}
|
||||
@@ -128,11 +157,11 @@ namespace v2rayN.Handler
|
||||
list.options = optionsPtr;
|
||||
|
||||
// and then make a pointer out of the whole list
|
||||
IntPtr ipcoListPtr = Marshal.AllocCoTaskMem(list.dwSize); // !! remember to deallocate memory 5
|
||||
nint ipcoListPtr = Marshal.AllocCoTaskMem(list.dwSize); // !! remember to deallocate memory 5
|
||||
Marshal.StructureToPtr(list, ipcoListPtr, false);
|
||||
|
||||
// and finally, call the API method!
|
||||
bool isSuccess = NativeMethods.InternetSetOption(IntPtr.Zero,
|
||||
bool isSuccess = NativeMethods.InternetSetOption(nint.Zero,
|
||||
InternetOption.INTERNET_OPTION_PER_CONNECTION_OPTION,
|
||||
ipcoListPtr, list.dwSize);
|
||||
int returnvalue = 0; // ERROR_SUCCESS
|
||||
@@ -143,12 +172,12 @@ namespace v2rayN.Handler
|
||||
else
|
||||
{
|
||||
// Notify the system that the registry settings have been changed and cause them to be refreshed
|
||||
NativeMethods.InternetSetOption(IntPtr.Zero, InternetOption.INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
|
||||
NativeMethods.InternetSetOption(IntPtr.Zero, InternetOption.INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
|
||||
NativeMethods.InternetSetOption(nint.Zero, InternetOption.INTERNET_OPTION_SETTINGS_CHANGED, nint.Zero, 0);
|
||||
NativeMethods.InternetSetOption(nint.Zero, InternetOption.INTERNET_OPTION_REFRESH, nint.Zero, 0);
|
||||
}
|
||||
|
||||
// FREE the data ASAP
|
||||
if (list.szConnection != IntPtr.Zero) Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (list.szConnection != nint.Zero) Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (optionCount > 1)
|
||||
{
|
||||
Marshal.FreeHGlobal(options[1].m_Value.m_StringPtr); // release mem 1
|
||||
@@ -212,12 +241,12 @@ namespace v2rayN.Handler
|
||||
public struct InternetPerConnOptionList
|
||||
{
|
||||
public int dwSize; // size of the INTERNET_PER_CONN_OPTION_LIST struct
|
||||
public IntPtr szConnection; // connection name to set/query options
|
||||
public nint szConnection; // connection name to set/query options
|
||||
public int dwOptionCount; // number of options to set/query
|
||||
public int dwOptionError; // on error, which option failed
|
||||
|
||||
//[MarshalAs(UnmanagedType.)]
|
||||
public IntPtr options;
|
||||
public nint options;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
@@ -244,7 +273,7 @@ namespace v2rayN.Handler
|
||||
public int m_Int;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public IntPtr m_StringPtr;
|
||||
public nint m_StringPtr;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
@@ -316,7 +345,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
[DllImport("WinInet.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool InternetSetOption(IntPtr hInternet, InternetOption dwOption, IntPtr lpBuffer, int dwBufferLength);
|
||||
public static extern bool InternetSetOption(nint hInternet, InternetOption dwOption, nint lpBuffer, int dwBufferLength);
|
||||
|
||||
[DllImport("Rasapi32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern uint RasEnumEntries(
|
||||
@@ -11,7 +11,7 @@ namespace v2rayN.Converters
|
||||
|
||||
if (delay <= 0)
|
||||
return new SolidColorBrush(Colors.Red);
|
||||
if (delay <= 200)
|
||||
if (delay <= 500)
|
||||
return new SolidColorBrush(Colors.Green);
|
||||
else
|
||||
return new SolidColorBrush(Colors.IndianRed);
|
||||
|
||||
@@ -172,6 +172,7 @@ namespace v2rayN
|
||||
|
||||
public static readonly List<string> AllowInsecure = new() { "true", "false", "" };
|
||||
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
||||
public static readonly List<string> SingboxDomainStrategy4Out = new() { "ipv4_only", "prefer_ipv4", "prefer_ipv6", "ipv6_only", "" };
|
||||
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" };
|
||||
public static readonly List<string> Alpns = new() { "h3", "h2", "http/1.1", "h3,h2,http/1.1", "h3,h2", "h2,http/1.1", "" };
|
||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using v2rayN.Enums;
|
||||
@@ -825,7 +826,7 @@ namespace v2rayN.Handler.CoreConfig
|
||||
}
|
||||
singboxConfig.dns = dns4Sbox;
|
||||
|
||||
GenDnsDomains(node, singboxConfig);
|
||||
GenDnsDomains(node, singboxConfig, item?.domainStrategy4Freedom);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -834,7 +835,7 @@ namespace v2rayN.Handler.CoreConfig
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GenDnsDomains(ProfileItem? node, SingboxConfig singboxConfig)
|
||||
private int GenDnsDomains(ProfileItem? node, SingboxConfig singboxConfig, string? strategy)
|
||||
{
|
||||
var dns4Sbox = singboxConfig.dns ?? new();
|
||||
dns4Sbox.servers ??= [];
|
||||
@@ -846,7 +847,7 @@ namespace v2rayN.Handler.CoreConfig
|
||||
tag = tag,
|
||||
address = "223.5.5.5",
|
||||
detour = Global.DirectTag,
|
||||
//strategy = strategy
|
||||
strategy = strategy
|
||||
});
|
||||
|
||||
var lstDomain = singboxConfig.outbounds
|
||||
@@ -966,27 +967,41 @@ namespace v2rayN.Handler.CoreConfig
|
||||
}
|
||||
}
|
||||
|
||||
//Local srs files address
|
||||
var localSrss = Utils.GetBinPath("srss");
|
||||
|
||||
//Add ruleset srs
|
||||
singboxConfig.route.rule_set = [];
|
||||
foreach (var item in new HashSet<string>(ruleSets))
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(item)) { continue; }
|
||||
var customRuleset = customRulesets.FirstOrDefault(t => t.tag != null && t.tag.Equals(item));
|
||||
if (customRuleset != null)
|
||||
if (customRuleset is null)
|
||||
{
|
||||
singboxConfig.route.rule_set.Add(customRuleset);
|
||||
}
|
||||
else
|
||||
{
|
||||
singboxConfig.route.rule_set.Add(new()
|
||||
var pathSrs = Path.Combine(localSrss, $"{item}.srs");
|
||||
if (File.Exists(pathSrs))
|
||||
{
|
||||
type = "remote",
|
||||
format = "binary",
|
||||
tag = item,
|
||||
url = string.Format(Global.SingboxRulesetUrl, item.StartsWith(geosite) ? geosite : geoip, item),
|
||||
download_detour = Global.ProxyTag
|
||||
});
|
||||
customRuleset = new()
|
||||
{
|
||||
type = "local",
|
||||
format = "binary",
|
||||
tag = item,
|
||||
path = pathSrs
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
customRuleset = new()
|
||||
{
|
||||
type = "remote",
|
||||
format = "binary",
|
||||
tag = item,
|
||||
url = string.Format(Global.SingboxRulesetUrl, item.StartsWith(geosite) ? geosite : geoip, item),
|
||||
download_detour = Global.ProxyTag
|
||||
};
|
||||
}
|
||||
}
|
||||
singboxConfig.route.rule_set.Add(customRuleset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1129,7 +1144,7 @@ namespace v2rayN.Handler.CoreConfig
|
||||
singboxConfig.route.rules.Add(rule);
|
||||
}
|
||||
|
||||
GenDnsDomains(null, singboxConfig);
|
||||
GenDnsDomains(null, singboxConfig, null);
|
||||
//var dnsServer = singboxConfig.dns?.servers.FirstOrDefault();
|
||||
//if (dnsServer != null)
|
||||
//{
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace v2rayN.Handler.Statistics
|
||||
{
|
||||
internal class StatisticsHandler
|
||||
{
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Text;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace v2rayN.Handler.Statistics
|
||||
{
|
||||
internal class StatisticsSingbox
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@ using ProtosLib.Statistics;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace v2rayN.Handler.Statistics
|
||||
{
|
||||
internal class StatisticsV2ray
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
using PacLib;
|
||||
using v2rayN.Common;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
@@ -42,17 +43,11 @@ namespace v2rayN.Handler
|
||||
.Replace("{http_port}", port.ToString())
|
||||
.Replace("{socks_port}", portSocks.ToString());
|
||||
}
|
||||
if (!ProxySetting.SetProxy(strProxy, strExceptions, 2))
|
||||
{
|
||||
SetProxy(strProxy, strExceptions, 2);
|
||||
}
|
||||
ProxySetting.SetProxy(strProxy, strExceptions, 2);
|
||||
}
|
||||
else if (type == ESysProxyType.ForcedClear)
|
||||
{
|
||||
if (!ProxySetting.UnsetProxy())
|
||||
{
|
||||
UnsetProxy();
|
||||
}
|
||||
ProxySetting.UnsetProxy();
|
||||
}
|
||||
else if (type == ESysProxyType.Unchanged)
|
||||
{
|
||||
@@ -61,10 +56,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
PacHandler.Start(Utils.GetConfigPath(), port, portPac);
|
||||
var strProxy = $"{Global.HttpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
|
||||
if (!ProxySetting.SetProxy(strProxy, "", 4))
|
||||
{
|
||||
SetProxy(strProxy, "", 4);
|
||||
}
|
||||
ProxySetting.SetProxy(strProxy, "", 4);
|
||||
}
|
||||
|
||||
if (type != ESysProxyType.Pac)
|
||||
@@ -81,38 +73,7 @@ namespace v2rayN.Handler
|
||||
|
||||
public static void ResetIEProxy4WindowsShutDown()
|
||||
{
|
||||
SetProxy(null, null, 1);
|
||||
}
|
||||
|
||||
private static void UnsetProxy()
|
||||
{
|
||||
SetProxy(null, null, 1);
|
||||
}
|
||||
|
||||
private static bool SetProxy(string? strProxy, string? exceptions, int type)
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
Utils.RegWriteValue(_regPath, "ProxyEnable", 0);
|
||||
Utils.RegWriteValue(_regPath, "ProxyServer", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "ProxyOverride", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "AutoConfigURL", string.Empty);
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
Utils.RegWriteValue(_regPath, "ProxyEnable", 1);
|
||||
Utils.RegWriteValue(_regPath, "ProxyServer", strProxy ?? string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "ProxyOverride", exceptions ?? string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "AutoConfigURL", string.Empty);
|
||||
}
|
||||
else if (type == 4)
|
||||
{
|
||||
Utils.RegWriteValue(_regPath, "ProxyEnable", 0);
|
||||
Utils.RegWriteValue(_regPath, "ProxyServer", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "ProxyOverride", string.Empty);
|
||||
Utils.RegWriteValue(_regPath, "AutoConfigURL", strProxy ?? string.Empty);
|
||||
}
|
||||
return true;
|
||||
ProxySetting.UnsetProxy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace v2rayN.Models
|
||||
public string stack { get; set; }
|
||||
public int mtu { get; set; }
|
||||
public bool enableExInbound { get; set; }
|
||||
public bool enableIPv6Address { get; set; } = true;
|
||||
public bool enableIPv6Address { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
+9
@@ -2734,6 +2734,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Default domain strategy for outbound 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsDomainStrategy4Out {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsDomainStrategy4Out", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Double-click server make active 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1297,4 +1297,7 @@
|
||||
<data name="menuProxiesSelectActivity" xml:space="preserve">
|
||||
<value>Select active node (Enter)</value>
|
||||
</data>
|
||||
<data name="TbSettingsDomainStrategy4Out" xml:space="preserve">
|
||||
<value>Default domain strategy for outbound</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1294,4 +1294,7 @@
|
||||
<data name="menuProxiesSelectActivity" xml:space="preserve">
|
||||
<value>设为活动节点 (Enter)</value>
|
||||
</data>
|
||||
<data name="TbSettingsDomainStrategy4Out" xml:space="preserve">
|
||||
<value>Outbound默认解析策略</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -21,6 +21,7 @@ namespace v2rayN.ViewModels
|
||||
[Reactive] public string normalDNS { get; set; }
|
||||
[Reactive] public string normalDNS2 { get; set; }
|
||||
[Reactive] public string tunDNS2 { get; set; }
|
||||
[Reactive] public string domainStrategy4Freedom2 { get; set; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> ImportDefConfig4V2rayCmd { get; }
|
||||
@@ -34,12 +35,13 @@ namespace v2rayN.ViewModels
|
||||
|
||||
var item = LazyConfig.Instance.GetDNSItem(ECoreType.Xray);
|
||||
useSystemHosts = item.useSystemHosts;
|
||||
domainStrategy4Freedom = item?.domainStrategy4Freedom!;
|
||||
normalDNS = item?.normalDNS!;
|
||||
domainStrategy4Freedom = item?.domainStrategy4Freedom ?? string.Empty;
|
||||
normalDNS = item?.normalDNS ?? string.Empty;
|
||||
|
||||
var item2 = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
||||
normalDNS2 = item2?.normalDNS!;
|
||||
tunDNS2 = item2?.tunDNS!;
|
||||
normalDNS2 = item2?.normalDNS ?? string.Empty;
|
||||
tunDNS2 = item2?.tunDNS ?? string.Empty;
|
||||
domainStrategy4Freedom2 = item2?.domainStrategy4Freedom ?? string.Empty;
|
||||
|
||||
SaveCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
@@ -105,6 +107,7 @@ namespace v2rayN.ViewModels
|
||||
var item2 = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
||||
item2.normalDNS = JsonUtils.Serialize(JsonUtils.ParseJson(normalDNS2));
|
||||
item2.tunDNS = JsonUtils.Serialize(JsonUtils.ParseJson(tunDNS2));
|
||||
item2.domainStrategy4Freedom = domainStrategy4Freedom2;
|
||||
ConfigHandler.SaveDNSItems(_config, item2);
|
||||
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Windows.Media;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Handler;
|
||||
using v2rayN.Handler.Fmt;
|
||||
using v2rayN.Handler.Statistics;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
using v2rayN.Views;
|
||||
@@ -612,6 +613,10 @@ namespace v2rayN.ViewModels
|
||||
|
||||
private void UpdateHandler(bool notify, string msg)
|
||||
{
|
||||
if (!_showInTaskbar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_noticeHandler?.SendMessage(msg);
|
||||
if (notify)
|
||||
{
|
||||
|
||||
@@ -132,6 +132,19 @@
|
||||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsDomainStrategy4Out}" />
|
||||
<ComboBox
|
||||
x:Name="cmbdomainStrategy4Out"
|
||||
Width="200"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid Margin="{StaticResource SettingItemMargin}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
|
||||
@@ -34,12 +34,18 @@ namespace v2rayN.Views
|
||||
{
|
||||
cmbdomainStrategy4Freedom.Items.Add(it);
|
||||
});
|
||||
Global.SingboxDomainStrategy4Out.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy4Out.Items.Add(it);
|
||||
});
|
||||
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.useSystemHosts, v => v.togUseSystemHosts.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.normalDNS, v => v.txtnormalDNS.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom2, v => v.cmbdomainStrategy4Out.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.normalDNS2, v => v.txtnormalDNS2.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.tunDNS2, v => v.txttunDNS2.Text).DisposeWith(disposables);
|
||||
|
||||
|
||||
+4
-4
@@ -13,17 +13,17 @@ require (
|
||||
github.com/pelletier/go-toml v1.9.5
|
||||
github.com/pires/go-proxyproto v0.7.0
|
||||
github.com/quic-go/quic-go v0.45.1
|
||||
github.com/refraction-networking/utls v1.6.6
|
||||
github.com/refraction-networking/utls v1.6.7
|
||||
github.com/sagernet/sing v0.4.1
|
||||
github.com/sagernet/sing-shadowsocks v0.2.6
|
||||
github.com/sagernet/sing-shadowsocks v0.2.7
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e
|
||||
github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3
|
||||
github.com/xtls/reality v0.0.0-20240429224917-ecc4401070cc
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
|
||||
golang.org/x/crypto v0.24.0
|
||||
golang.org/x/net v0.26.0
|
||||
golang.org/x/crypto v0.25.0
|
||||
golang.org/x/net v0.27.0
|
||||
golang.org/x/sync v0.7.0
|
||||
golang.org/x/sys v0.22.0
|
||||
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
|
||||
|
||||
+8
-8
@@ -112,15 +112,15 @@ github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7q
|
||||
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA=
|
||||
github.com/quic-go/quic-go v0.45.1/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
|
||||
github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig=
|
||||
github.com/refraction-networking/utls v1.6.6/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
|
||||
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
|
||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
|
||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/sagernet/sing v0.4.1 h1:zVlpE+7k7AFoC2pv6ReqLf0PIHjihL/jsBl5k05PQFk=
|
||||
github.com/sagernet/sing v0.4.1/go.mod h1:ieZHA/+Y9YZfXs2I3WtuwgyCZ6GPsIR7HdKb1SdEnls=
|
||||
github.com/sagernet/sing-shadowsocks v0.2.6 h1:xr7ylAS/q1cQYS8oxKKajhuQcchd5VJJ4K4UZrrpp0s=
|
||||
github.com/sagernet/sing-shadowsocks v0.2.6/go.mod h1:j2YZBIpWIuElPFL/5sJAj470bcn/3QQ5lxZUNKLDNAM=
|
||||
github.com/sagernet/sing-shadowsocks v0.2.7 h1:zaopR1tbHEw5Nk6FAkM05wCslV6ahVegEZaKMv9ipx8=
|
||||
github.com/sagernet/sing-shadowsocks v0.2.7/go.mod h1:0rIKJZBR65Qi0zwdKezt4s57y/Tl1ofkaq6NlkzVuyE=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb h1:XfLJSPIOUX+osiMraVgIrMR27uMXnRJWGm1+GL8/63U=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
@@ -177,8 +177,8 @@ golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnf
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg=
|
||||
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
|
||||
@@ -199,8 +199,8 @@ golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
|
||||
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
|
||||
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
||||
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/dice"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
@@ -18,9 +16,12 @@ func (c *Config) getHosts() []string {
|
||||
}
|
||||
|
||||
func (c *Config) isValidHost(host string) bool {
|
||||
if len(c.Host) == 0 {
|
||||
return true
|
||||
}
|
||||
hosts := c.getHosts()
|
||||
for _, h := range hosts {
|
||||
if strings.Contains(strings.ToLower(host), strings.ToLower(h)) {
|
||||
if internet.IsValidHTTPHost(host, h) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func (s *server) Handle(conn net.Conn) (stat.Connection, error) {
|
||||
|
||||
if s.config != nil {
|
||||
host := req.Host
|
||||
if len(s.config.Host) > 0 && !strings.Contains(strings.ToLower(host), strings.ToLower(s.config.Host)) {
|
||||
if len(s.config.Host) > 0 && !internet.IsValidHTTPHost(host, s.config.Host) {
|
||||
return nil, errors.New("bad host: ", host)
|
||||
}
|
||||
path := s.config.GetNormalizedPath()
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
package internet
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
|
||||
|
||||
func IsValidHTTPHost(request string, config string) bool {
|
||||
r := strings.ToLower(request)
|
||||
c := strings.ToLower(config)
|
||||
if strings.Contains(r, ":") {
|
||||
h, _, _ := net.SplitHostPort(r)
|
||||
return h == c
|
||||
}
|
||||
return r == c
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func (h *requestHandler) upsertSession(sessionId string) *httpSession {
|
||||
}
|
||||
|
||||
func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
|
||||
if len(h.host) > 0 && !strings.Contains(strings.ToLower(request.Host), strings.ToLower(h.host)) {
|
||||
if len(h.host) > 0 && !internet.IsValidHTTPHost(request.Host, h.host) {
|
||||
errors.LogInfo(context.Background(), "failed to validate host, request:", request.Host, ", config:", h.host)
|
||||
writer.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
|
||||
@@ -38,7 +38,7 @@ var upgrader = &websocket.Upgrader{
|
||||
}
|
||||
|
||||
func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
|
||||
if len(h.host) > 0 && !strings.Contains(strings.ToLower(request.Host), strings.ToLower(h.host)) {
|
||||
if len(h.host) > 0 && !internet.IsValidHTTPHost(request.Host, h.host) {
|
||||
errors.LogInfo(context.Background(), "failed to validate host, request:", request.Host, ", config:", h.host)
|
||||
writer.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
|
||||
@@ -2159,6 +2159,20 @@ else()
|
||||
message(STATUS "Compiling with no GUI support")
|
||||
endif()
|
||||
|
||||
# setup gui flavour header
|
||||
if (GUI)
|
||||
set(_GUI_FLAVOUR_ ${GUI_FLAVOUR})
|
||||
else()
|
||||
set(_GUI_FLAVOUR_ "unspec")
|
||||
endif()
|
||||
|
||||
set(GUI_VARIANT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/gui_variant.h")
|
||||
configure_file("src/gui_variant.h.in" "${GUI_VARIANT_HEADER}" @ONLY)
|
||||
set(SUPPORT_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${SUPPORT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# *****************************************************************************************
|
||||
# Compiler compiler and link flags (common)
|
||||
# *****************************************************************************************
|
||||
@@ -4317,6 +4331,7 @@ message(STATUS "Enabled Feature: ${YASS_APP_FEATURES}")
|
||||
# *****************************************************************************************
|
||||
|
||||
if (GUI)
|
||||
message(STATUS "GUI Variant: ${GUI_FLAVOUR}")
|
||||
set(APP_NAME yass)
|
||||
set(SRC_FILES)
|
||||
if (GUI_FLAVOUR STREQUAL "android")
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "core/utils.hpp"
|
||||
#include "crashpad_helper.hpp"
|
||||
|
||||
namespace config {
|
||||
const ProgramType pType = YASS_CLIENT_GUI;
|
||||
} // namespace config
|
||||
|
||||
// Data
|
||||
static bool g_Initialized = false;
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#include "net/resolver.hpp"
|
||||
#include "version.h"
|
||||
|
||||
const ProgramType pType = YASS_CLIENT;
|
||||
namespace config {
|
||||
const ProgramType pType = YASS_CLIENT_DEFAULT;
|
||||
} // namespace config
|
||||
|
||||
using namespace net::cli;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "cli/cli_server.hpp"
|
||||
|
||||
using namespace std::string_literals;
|
||||
const ProgramType pType = YASS_CLIENT_SLAVE;
|
||||
|
||||
using namespace net::cli;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ bool ReadConfig() {
|
||||
client_required_fields_loaded &= config_impl->Read("local", &FLAGS_local_host);
|
||||
client_required_fields_loaded &= config_impl->Read("local_port", &FLAGS_local_port);
|
||||
|
||||
if (pType == YASS_CLIENT || pType == YASS_CLIENT_SLAVE) {
|
||||
if (pType & YASS_CLIENT_MASK) {
|
||||
required_fields_loaded &= client_required_fields_loaded;
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ bool ReadConfig() {
|
||||
config_impl->Read("cacert", &FLAGS_cacert);
|
||||
config_impl->Read("capath", &FLAGS_capath);
|
||||
config_impl->Read("certificate_chain_file", &FLAGS_certificate_chain_file);
|
||||
if (pType == YASS_SERVER) {
|
||||
if (pType & YASS_SERVER_MASK) {
|
||||
config_impl->Read("private_key_file", &FLAGS_private_key_file);
|
||||
config_impl->Read("private_key_password", &FLAGS_private_key_password, true);
|
||||
}
|
||||
if (pType == YASS_CLIENT || pType == YASS_CLIENT_SLAVE) {
|
||||
if (pType & YASS_CLIENT_MASK) {
|
||||
config_impl->Read("insecure_mode", &FLAGS_insecure_mode);
|
||||
config_impl->Read("enable_post_quantum_kyber", &FLAGS_enable_post_quantum_kyber);
|
||||
}
|
||||
@@ -135,11 +135,11 @@ bool SaveConfig() {
|
||||
all_fields_written &= config_impl->Write("cacert", FLAGS_cacert);
|
||||
all_fields_written &= config_impl->Write("capath", FLAGS_capath);
|
||||
all_fields_written &= config_impl->Write("certificate_chain_file", FLAGS_certificate_chain_file);
|
||||
if (pType == YASS_SERVER) {
|
||||
if (pType & YASS_SERVER_MASK) {
|
||||
all_fields_written &= config_impl->Write("private_key_file", FLAGS_private_key_file);
|
||||
all_fields_written &= config_impl->Write("private_key_password", FLAGS_private_key_password);
|
||||
}
|
||||
if (pType == YASS_CLIENT || pType == YASS_CLIENT_SLAVE) {
|
||||
if (pType & YASS_CLIENT_MASK) {
|
||||
all_fields_written &= config_impl->Write("insecure_mode", FLAGS_insecure_mode);
|
||||
all_fields_written &= config_impl->Write("enable_post_quantum_kyber", FLAGS_enable_post_quantum_kyber);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user