Merge remote-tracking branch 'meta/Alpha' into Alpha

This commit is contained in:
Skyxim 2022-10-03 22:41:40 +08:00
commit f2b5ae6894
4 changed files with 49 additions and 49 deletions

View file

@ -54,6 +54,7 @@ type VmessOption struct {
PacketAddr bool `proxy:"packet-addr,omitempty"` PacketAddr bool `proxy:"packet-addr,omitempty"`
XUDP bool `proxy:"xudp,omitempty"` XUDP bool `proxy:"xudp,omitempty"`
PacketEncoding string `proxy:"packet-encoding,omitempty"` PacketEncoding string `proxy:"packet-encoding,omitempty"`
GlobalPadding bool `proxy:"global-padding,omitempty"`
AuthenticatedLength bool `proxy:"authenticated-length,omitempty"` AuthenticatedLength bool `proxy:"authenticated-length,omitempty"`
} }
@ -311,6 +312,9 @@ func (v *Vmess) SupportUOT() bool {
func NewVmess(option VmessOption) (*Vmess, error) { func NewVmess(option VmessOption) (*Vmess, error) {
security := strings.ToLower(option.Cipher) security := strings.ToLower(option.Cipher)
var options []vmess.ClientOption var options []vmess.ClientOption
if option.GlobalPadding {
options = append(options, vmess.ClientWithGlobalPadding())
}
if option.AuthenticatedLength { if option.AuthenticatedLength {
options = append(options, vmess.ClientWithAuthenticatedLength()) options = append(options, vmess.ClientWithAuthenticatedLength())
} }

View file

@ -1,34 +0,0 @@
{ lib
, fetchFromGitHub
, buildGoModule
}:
buildGoModule rec {
pname = "clash-meta";
version = "dev";
src = ./.;
vendorSha256 = "sha256-7HjYcoqWA5gvPUc5psCgy0UTc17CBzBJ/OiGvII/iBA=";
# Do not build testing suit
excludedPackages = [ "./test" ];
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/Dreamacro/clash/constant.Version=${version}"
];
# network required
doCheck = false;
postInstall = ''
mv $out/bin/clash $out/bin/clash-meta
'';
meta = with lib; {
description = "Another Clash Kernel";
homepage = "https://github.com/MetaCubeX/Clash.Meta";
license = licenses.gpl3Only;
};
}

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1664638641, "lastModified": 1664705630,
"narHash": "sha256-r2gVLq9DD1A0Igv4AdkmpuuVykXmKVsJTAJinS/ZFrM=", "narHash": "sha256-MLi1J9tIZQFj8v9RKmG89HJAE5ja3z4ui4Tf9+wG/bM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cb81a9ca94e7631bc67788d858e214d56571983a", "rev": "f71b215225dec75df6266ff7764d54c2e44ef226",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -9,17 +9,47 @@
utils.lib.eachDefaultSystem utils.lib.eachDefaultSystem
(system: (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs {
in inherit system;
{ overlays = [ self.overlay ];
packages = rec{
clash-meta = pkgs.callPackage ./. { };
default = clash-meta;
}; };
in
rec {
packages.default = pkgs.clash-meta;
}
) //
(
let version = nixpkgs.lib.substring 0 8 self.lastModifiedDate or self.lastModified or "19700101"; in
{
overlay = final: prev: {
apps = rec { clash-meta = final.buildGoModule {
clash-meta = utils.lib.mkApp { drv = self.packages.${system}.clash-meta; }; pname = "clash-meta";
default = clash-meta; inherit version;
src = ./.;
vendorSha256 = "sha256-Af1RgeB6APxKW9m+rm2mkpYSXwAgFTzRyW0GJe9ML+A=";
# Do not build testing suit
excludedPackages = [ "./test" ];
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/Dreamacro/clash/constant.Version=dev-${version}"
"-X github.com/Dreamacro/clash/constant.BuildTime=${version}"
];
# Network required
doCheck = false;
postInstall = ''
mv $out/bin/clash $out/bin/clash-meta
'';
};
}; };
} }
); );