<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Linus的FUN天地 (English)</title><description>Linus Xiong&apos;s personal blog: tech notes, ops practice and everyday life.</description><link>https://blog.xsy.fun/en/</link><language>en</language><lastBuildDate>Wed, 21 Oct 2026 01:00:00 GMT</lastBuildDate><atom:link href="https://blog.xsy.fun/en/rss.xml" rel="self" type="application/rss+xml"/><generator>Astro</generator><item><title>Why Is the New Blog So Fast? From Stack Choice to Every Byte</title><link>https://blog.xsy.fun/en/posts/why-this-blog-is-fast/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/why-this-blog-is-fast/</guid><description>After rewriting the blog from Hexo to Astro, first paint takes about a second and Lighthouse scores 100 across the board. This article explains the stack choice, the build pipeline, and the trade-offs behind CSS, JavaScript, fonts, images, navigation and SEO, with measured numbers.</description><pubDate>Wed, 21 Oct 2026 01:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I rebuilt the blog. The most obvious change is that any page appears almost the moment you open it. That did not come from a more expensive server. It came from removing, at every layer, everything that was not needed, starting with the choice of stack. This article explains the trade-offs: why a static site and why Astro, what the build pipeline looks like, what CSS, JavaScript, fonts, images, page transitions and SEO each do, and the numbers that show the effect.&lt;/p&gt;
&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;the-result-first&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#the-result-first&quot;&gt;The result first&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Production numbers for a typical post page (mobile Lighthouse with simulated slow network):&lt;/p&gt;
&lt;div class=&quot;table-wrap&quot; tabindex=&quot;0&quot;&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;HTML (gzipped)&lt;/td&gt;&lt;td&gt;16–18 KB, styles included&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CSS&lt;/td&gt;&lt;td&gt;about 20 KB, inlined in the page, zero extra requests&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;JavaScript on first paint&lt;/td&gt;&lt;td&gt;about 6 KB (theme switch, search launcher, copy button, link prefetch)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Web fonts&lt;/td&gt;&lt;td&gt;0 bytes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Third-party requests on first paint&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Lighthouse&lt;/td&gt;&lt;td&gt;Performance 100 · Accessibility 100 · Best Practices 100 · SEO 100&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CLS (layout shift)&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;None of this comes from one trick. It is the sum of doing a little less at every layer.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;why-a-static-site-and-why-astro&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#why-a-static-site-and-why-astro&quot;&gt;Why a static site, and why Astro&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A blog is finished writing handed to readers; the content is fixed the moment I commit it. So there is no reason to render it on a server for every visit, and even less reason to make the reader&apos;s browser download an application framework and &quot;hydrate&quot; the article. The first decision was therefore: &lt;strong&gt;generate all HTML at build time&lt;/strong&gt; and let the server, really a CDN, only send files.&lt;/p&gt;
&lt;p&gt;While choosing, I built several candidates and measured how much JavaScript each ships on a prerendered post page:&lt;/p&gt;
&lt;div class=&quot;table-wrap&quot; tabindex=&quot;0&quot;&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;/th&gt;&lt;th&gt;JS on a post page (gzip)&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Astro 7 (static output)&lt;/td&gt;&lt;td&gt;&lt;strong&gt;0 B&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;zero JS by default; &quot;islands&quot; load on demand when interaction is needed&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TanStack Start 1.0 (React)&lt;/td&gt;&lt;td&gt;about 108 KB&lt;/td&gt;&lt;td&gt;still hydrates the whole page after prerendering; no zero-JS mode&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;TanStack Start (Solid)&lt;/td&gt;&lt;td&gt;about 48 KB&lt;/td&gt;&lt;td&gt;same, with a smaller runtime&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Next.js App Router&lt;/td&gt;&lt;td&gt;tens of KB plus the RSC payload&lt;/td&gt;&lt;td&gt;an archived page of a well-known blog weighed 645 KB of HTML, 61% of it inline component data&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;The TanStack family is excellent for applications, but its Markdown package has only just reached 1.0 and its official example parses Markdown in the browser, the opposite of what a content site wants. In Astro, content collections, image optimisation, Shiki highlighting, sitemap and RSS are first-class, and a page ships not a single byte of JavaScript unless asked. That is exactly what I needed.&lt;/p&gt;
&lt;p&gt;I also measured a React component library in the HeroUI style: one button island costs 96 KB, about 70 KB of which is React. In the end I borrowed only its visual language; every button, chip and card is a zero-JS Astro component.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;the-build-pipeline&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#the-build-pipeline&quot;&gt;The build pipeline&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;diagram&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;pre class=&quot;mermaid&quot; data-source=&quot;graph LR
  A[content/posts/*.md] --&gt; B[content collection + Zod validation]
  B --&gt; C[remark plugins&lt;br/&gt;excerpt · reading time]
  C --&gt; D[rehype plugins&lt;br/&gt;heading anchors · code-block chrome · tables · sections]
  D --&gt; E[Shiki highlighting&lt;br/&gt;light + dark]
  E --&gt; F[page HTML&lt;br/&gt;CSS inlined]
  F --&gt; G[dist/ + Pagefind index + OG images + sitemap]&quot;&gt;graph LR
  A[content/posts/*.md] --&gt; B[content collection + Zod validation]
  B --&gt; C[remark plugins&amp;#x3C;br/&gt;excerpt · reading time]
  C --&gt; D[rehype plugins&amp;#x3C;br/&gt;heading anchors · code-block chrome · tables · sections]
  D --&gt; E[Shiki highlighting&amp;#x3C;br/&gt;light + dark]
  E --&gt; F[page HTML&amp;#x3C;br/&gt;CSS inlined]
  F --&gt; G[dist/ + Pagefind index + OG images + sitemap]&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;A post is a Markdown file under &lt;code&gt;content/posts/&lt;/code&gt;, and its frontmatter is validated with Zod: a malformed date or a slug containing Chinese or spaces fails the build instead of surfacing after deployment. Markdown goes through a remark/rehype pipeline: everything before &lt;code&gt;&amp;#x3C;!-- more --&gt;&lt;/code&gt; becomes the excerpt; reading time counts Chinese at 300 characters per minute and English at 200 words per minute, separately; every heading gets a stable id and an anchor; code blocks are wrapped in a shell with a language label and a copy button; each &lt;code&gt;h2&lt;/code&gt; section becomes a &lt;code&gt;&amp;#x3C;section&gt;&lt;/code&gt; with &lt;code&gt;content-visibility: auto&lt;/code&gt;, so a long article only lays out what is visible.&lt;/p&gt;
&lt;p&gt;Syntax highlighting happens at build time. Shiki emits both the light and the dark palette as CSS variables on every token, so switching themes only swaps a set of variables and no highlighter ever runs in the browser.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;css-20-kb-inlined-no-flash&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#css-20-kb-inlined-no-flash&quot;&gt;CSS: 20 KB, inlined, no flash&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Styles use Tailwind v4 with design tokens (colours, type sizes, radii) in &lt;code&gt;@theme&lt;/code&gt;; components reference tokens only. At build time Tailwind emits only the utilities actually used, about 20 KB for the whole site, and &lt;code&gt;inlineStylesheets: &apos;always&apos;&lt;/code&gt; writes them straight into every page: one request fewer, and the first paint waits for no external file.&lt;/p&gt;
&lt;p&gt;I set a hard budget: the inlined CSS of a post page must stay under 20 KiB, re-measured after every style change. It nearly broke twice, and both causes are instructive. Tailwind scans source files for anything that looks like a class name, so property names such as &lt;code&gt;transition&lt;/code&gt; or &lt;code&gt;grid&lt;/code&gt; written inside component styles were emitted as utilities into the global stylesheet; the fix is an exclusion list for those words. The other time, styles needed only on post pages ended up in the global stylesheet, because Astro bundles component styles by the import graph, not by whether a component rendered.&lt;/p&gt;
&lt;p&gt;Dark mode is applied by an inline script of under 1 KB in &lt;code&gt;&amp;#x3C;head&gt;&lt;/code&gt; that sets &lt;code&gt;data-theme&lt;/code&gt; before the first paint, so there is no light-then-dark flash. The dark background is a near-black &lt;code&gt;#121214&lt;/code&gt; rather than pure black, which is easier on the eyes for long reads, and hierarchy is expressed with lighter surfaces instead of outlines.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;javascript-on-demand-and-small&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#javascript-on-demand-and-small&quot;&gt;JavaScript: on demand, and small&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A post page carries four small scripts: the theme switch (1.0 KB), the search launcher (1.4 KB), code copying (0.5 KB) and link prefetching (2.4 KB). Everything heavy is deferred:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Comments (Disqus)&lt;/strong&gt;: the embed script is injected only when the comment area comes within 600 px of the viewport.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Search (Pagefind)&lt;/strong&gt;: the static index is built at build time; the UI and index chunks load when the search box opens.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Diagrams (Mermaid)&lt;/strong&gt;: the library is several megabytes, so it is dynamically imported only on pages that contain a diagram, when the diagram nears the viewport, and it re-renders after a theme switch.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;No React, no client-side router, no Markdown parsing in the browser.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;fonts-not-a-single-byte-downloaded&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#fonts-not-a-single-byte-downloaded&quot;&gt;Fonts: not a single byte downloaded&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chinese web fonts easily reach several megabytes, and even subset they weigh on the first paint. The site uses the device&apos;s own font stack instead: SF Pro and PingFang on Apple platforms, Microsoft YaHei on Windows, Noto Sans CJK on Linux and Android. Icons are inline SVG, not icon fonts.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;images-prepared-at-build-time&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#images-prepared-at-build-time&quot;&gt;Images: prepared at build time&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Images in a post folder are converted to WebP by sharp at build time, with a &lt;code&gt;srcset&lt;/code&gt; at several widths from 640 to 1280 px; &lt;code&gt;sizes&lt;/code&gt; matches the 832 px text column, so a phone never downloads the desktop size. Every image carries its intrinsic width and height, so the page never jumps while images load, which is what keeps CLS at zero. The cover is the largest element above the fold (the LCP), so it loads eagerly with &lt;code&gt;fetchpriority=&quot;high&quot;&lt;/code&gt;; body images use native lazy loading.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;page-transitions-like-turning-a-page&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#page-transitions-like-turning-a-page&quot;&gt;Page transitions: like turning a page&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Three things stack up:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Links are prefetched on hover (Astro&apos;s prefetch, 2.4 KB).&lt;/li&gt;
&lt;li&gt;Chromium&apos;s Speculation Rules: a block of JSON that lets the browser prerender the next page in the background on hover, with zero JavaScript.&lt;/li&gt;
&lt;li&gt;Cross-document View Transitions: pure CSS, &lt;code&gt;@view-transition { navigation: auto }&lt;/code&gt;, for a crossfade between pages.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The third one hid a trap. The browser captures the new page at its first rendering opportunity, and Chromium renders before the &lt;code&gt;&amp;#x3C;body&gt;&lt;/code&gt; is fully parsed, so the crossfade landed on a blank page and the content popped in afterwards. The fix is a single tag that makes rendering wait until the end of the page has been parsed:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; rel&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;expect&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; href&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;#page-end&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; blocking&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;render&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Pages are only a few dozen kilobytes, so this line costs no first-paint time and buys a complete transition.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;seo-and-urls&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#seo-and-urls&quot;&gt;SEO and URLs&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ASCII URLs only&lt;/strong&gt;: Chinese titles become pinyin slugs automatically; the old Hexo links (with spaces and Chinese) are kept in the frontmatter &lt;code&gt;aliases&lt;/code&gt;. The build writes a redirect page with a canonical link for each old URL, and on Vercel they become real 308 redirects, so search rankings migrate smoothly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;An Open Graph image per post&lt;/strong&gt; is rendered at build time with satori and resvg (the Chinese font is downloaded as a per-text subset and cached), so shares on social platforms get a picture.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sitemap with &lt;code&gt;lastmod&lt;/code&gt;&lt;/strong&gt;, full-content RSS, Atom and JSON Feed, and JSON-LD &lt;code&gt;BlogPosting&lt;/code&gt; and breadcrumb markup.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chinese and English&lt;/strong&gt;: the English version is a &lt;code&gt;.en.md&lt;/code&gt; file next to the source, with &lt;code&gt;hreflang&lt;/code&gt; and its own feeds. Translations can be written by hand or generated in bulk through DeepL, Google or a language-model API; each one records a hash of the source and is flagged as stale when the source changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;hosting&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#hosting&quot;&gt;Hosting&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The site is deployed on Vercel, with static files served from the CDN. Hashed assets under &lt;code&gt;/_astro/*&lt;/code&gt; are cached for a year and marked &lt;code&gt;immutable&lt;/code&gt;; HTML uses &lt;code&gt;must-revalidate&lt;/code&gt;; security headers and the trailing-slash policy live in &lt;code&gt;vercel.json&lt;/code&gt;. CI runs &lt;code&gt;pnpm build&lt;/code&gt; together with type checking and more than five hundred unit tests.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;trade-offs-and-things-left-undone&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#trade-offs-and-things-left-undone&quot;&gt;Trade-offs and things left undone&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Disqus&apos;s iframe prevents bfcache (the browser&apos;s back/forward cache). That is the price of third-party comments; loading it only when scrolled into view keeps the impact minimal.&lt;/li&gt;
&lt;li&gt;Mermaid is large, so it loads on demand; if diagrams become common, rendering them to SVG at build time would be the next step.&lt;/li&gt;
&lt;li&gt;Pagefind has no Chinese stemming; substring search is good enough.&lt;/li&gt;
&lt;li&gt;Pinyin slugs read worse than English ones, so there is a command that generates English slugs with a language model and turns the old slugs into aliases.&lt;/li&gt;
&lt;li&gt;No runtime UI library at all. Should a HeroUI-style interactive component ever be needed, it will live in an island that loads only after a click.&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;how-it-is-measured&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/why-this-blog-is-fast/#how-it-is-measured&quot;&gt;How it is measured&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Every change is followed by a mobile Lighthouse run, plus a script that measures the inlined CSS bytes and the total script size of a post page; exceeding the budget counts as a failure. The tools are simple. The hard part is keeping &quot;do less&quot; as a rule.&lt;/p&gt;
&lt;p&gt;The whole codebase is open source. If you want to build your own, a single &lt;code&gt;pnpm build&lt;/code&gt; turns the Markdown in &lt;code&gt;content/&lt;/code&gt; into a site like this one.&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>Astro</category><category>性能</category><category>前端</category><category>博客</category><category>Markdown</category></item><item><title>Binding an IPv6 Address Pool to a New NIC on a BIRD2 Host and Enabling Multi-Source IPv6 Outbound Traffic</title><link>https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/</guid><description>This post records the process of using an IPv6 /47 address pool as locally bindable addresses in a Linux + BIRD2 environment, and setting up a new dummy interface so that the addresses can be bound to and used for outbound traffic.</description><pubDate>Wed, 15 Apr 2026 14:00:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The goal this time is very clear:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The machine is already running BIRD2 and is correctly advertising IPv6 prefixes via BGP&lt;/li&gt;
&lt;li&gt;Now I want to use a &lt;code&gt;/47&lt;/code&gt; IPv6 prefix as an &lt;strong&gt;IPv6 address pool usable locally&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;At the same time, to keep the structure clearer, I plan to &quot;attach&quot; this address range to a new logical network interface&lt;/li&gt;
&lt;li&gt;The final result should be:
&lt;ul&gt;
&lt;li&gt;Applications can bind any IPv6 address within this &lt;code&gt;/47&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Traffic still leaves through the real physical network interface&lt;/li&gt;
&lt;li&gt;BIRD is only responsible for advertising and does not interfere with the system default route or address management&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: In this article, IPv4, IPv6, ASN, BGP neighbors, authentication passwords and other information have all been replaced with &lt;strong&gt;documentation example values&lt;/strong&gt;, to record the configuration approach and avoid exposing real production environment information.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;review-of-the-existing-bird2-configuration&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#review-of-the-existing-bird2-configuration&quot;&gt;Review of the Existing BIRD2 Configuration&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The BIRD2 configuration on the current machine has roughly a few key points:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;protocol direct&lt;/code&gt; Only tracks &lt;code&gt;dummy*&lt;/code&gt; interfaces&lt;/li&gt;
&lt;li&gt;&lt;code&gt;protocol kernel&lt;/code&gt; Is &lt;code&gt;import none; export none;&lt;/code&gt; for both IPv4 and IPv6&lt;/li&gt;
&lt;li&gt;In &lt;code&gt;protocol static static_v6&lt;/code&gt;, the IPv6 prefixes to be advertised are put into the BIRD RIB via &lt;code&gt;reject&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;BGP only exports the IPv6 prefixes of &lt;code&gt;RTS_STATIC&lt;/code&gt; to the outside&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In other words, this design itself already separates responsibilities very clearly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;BIRD is responsible for advertising&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The kernel is responsible for real forwarding and local address binding&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BIRD will not modify the kernel&apos;s default route&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This approach is correct and should be kept.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;to-state-the-conclusion-first-this-task-should-not-only-involve-changing-bird&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#to-state-the-conclusion-first-this-task-should-not-only-involve-changing-bird&quot;&gt;To state the conclusion first: this task should not only involve changing BIRD&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When many people first do this kind of configuration, they intuitively think &quot;since it&apos;s an advertised prefix, just bind it to the interface in BIRD.&quot;&lt;/p&gt;
&lt;p&gt;In reality, that&apos;s not how it works.&lt;/p&gt;
&lt;h3 id=&quot;the-role-of-bird&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#the-role-of-bird&quot;&gt;The Role of BIRD&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;BIRD only needs to do one thing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Keep announcing the target &lt;code&gt;/47&lt;/code&gt; prefix&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-role-of-the-linux-kernel&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#the-role-of-the-linux-kernel&quot;&gt;The Role of the Linux Kernel&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;What truly allows this &lt;code&gt;/47&lt;/code&gt; to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can run it locally with &lt;code&gt;bind()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Be used as source addresses when initiating connections&lt;/li&gt;
&lt;li&gt;Send traffic out through the real physical network interface&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;is the Linux network stack, not BIRD.&lt;/p&gt;
&lt;p&gt;So the final plan is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a new &lt;strong&gt;dummy interface&lt;/strong&gt;, for example &lt;code&gt;dummy47&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Assign it an &quot;anchor address&quot; from the pool&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;ip -6 route add local ...&lt;/code&gt; to tell the kernel that this entire &lt;code&gt;/47&lt;/code&gt; belongs to the local host&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;net.ipv6.ip_nonlocal_bind=1&lt;/code&gt; to allow applications to bind addresses that were not explicitly added to an interface&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;why-use-a-dummy-interface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#why-use-a-dummy-interface&quot;&gt;Why Use a Dummy Interface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Rather than directly putting the entire &lt;code&gt;/47&lt;/code&gt; onto the real physical interface, I created a separate logical interface &lt;code&gt;dummy47&lt;/code&gt;, for three reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clearer responsibilities&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dummy47&lt;/code&gt; indicates &quot;this is a locally managed business address pool&quot;&lt;/li&gt;
&lt;li&gt;The physical interface is only responsible for actually sending and receiving packets&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Easier troubleshooting&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When looking at the interface configuration, you can tell at a glance what this address pool is specifically for&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compatible with the existing BIRD configuration&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The current &lt;code&gt;protocol direct&lt;/code&gt; already matches &lt;code&gt;dummy*&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;No major changes are needed after creating &lt;code&gt;dummy47&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Note the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;dummy47&lt;/code&gt; is not the actual outgoing network interface.&lt;br&gt;
Actual packet transmission still goes through the physical interface corresponding to the default route, such as &lt;code&gt;eth0&lt;/code&gt; or &lt;code&gt;ens3&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;reference-approach-local-route--ip_nonlocal_bind&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#reference-approach-local-route--ip_nonlocal_bind&quot;&gt;Reference Approach: local route + ip_nonlocal_bind&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The core idea of this configuration is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Don&apos;t enumerate and add large numbers of static addresses&lt;/li&gt;
&lt;li&gt;Don&apos;t directly &lt;code&gt;addr add&lt;/code&gt; the entire prefix as ordinary addresses&lt;/li&gt;
&lt;li&gt;Instead, through:&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; local&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; lo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;sysctl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; net.ipv6.ip_nonlocal_bind=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Let the kernel consider:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This entire &lt;code&gt;/47&lt;/code&gt; as &quot;locally receivable&quot; addresses&lt;/li&gt;
&lt;li&gt;Processes can directly bind to any address within it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are the two most critical steps.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;sanitized-bird2-configuration-example&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#sanitized-bird2-configuration-example&quot;&gt;Sanitized BIRD2 Configuration Example&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Below is a sanitized configuration skeleton, used to illustrate the key parts relevant to this article.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bird&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bird&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bird&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#                 Variables                     #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNAS   &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 64500&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNIP   &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 198.51.100.10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNIPv6 &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 2001:db8:100::10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNNETSET_V4 &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; [];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNNETSET_V6 &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;    2001:db8:4700::/47&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#                 Global                        #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;router&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNIP;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; device&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    scan&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; time&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#                  Direct                       #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; direct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot;dummy*&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#              Kernel isolation                 #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; kernel&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; krt_ipv4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    scan&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; time&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 20&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        import &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        export &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; kernel&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; krt_ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    scan&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; time&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 20&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        import &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        export &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#              Static announcements             #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; static&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; static_v6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; reject&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        import &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;all&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        export &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#               BGP template                    #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; bgp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; tpl_bgp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    local&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; OWNAS&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    path metric&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    graceful restart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        import &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        export filter { &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;reject&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;; };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;        export limit&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; disable&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;        extended next hop&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        import &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        export filter {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;            if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; source&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; !=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; RTS_STATIC&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; then&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; reject&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;            accept&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;        export limit&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; disable&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;#                 Upstream BGP                  #&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;################################################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; bgp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; bgp_upstream_v4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; tpl_bgp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;    source&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; address&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNIP;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    neighbor&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 169.254.0.1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 64496&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    multihop&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    password&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot;REDACTED_PASSWORD&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; bgp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; bgp_upstream_v6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; tpl_bgp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;    source&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; address&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; OWNIPv6;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    neighbor&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 2001:db8:ffff::1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 64496&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    multihop&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    password&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot;REDACTED_PASSWORD&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;does-the-bird2-configuration-need-changes&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#does-the-bird2-configuration-need-changes&quot;&gt;Does the BIRD2 Configuration Need Changes?&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;In most cases, almost no changes are needed.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Because there are already:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bird&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bird&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bird&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; direct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot;dummy*&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;So as long as the new logical interface is named &lt;code&gt;dummy47&lt;/code&gt;, it will naturally be matched.&lt;/p&gt;
&lt;p&gt;And the IPv6 static advertisement part is itself correct:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bird&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bird&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bird&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; static&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; static_v6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; reject&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    ipv6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        import &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;all&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        export &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;why-not-change-47-from-reject&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#why-not-change-47-from-reject&quot;&gt;Why not change &lt;code&gt;/47&lt;/code&gt; from reject&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Because the &lt;code&gt;reject&lt;/code&gt; route here is only for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Getting the prefix into the BIRD RIB&lt;/li&gt;
&lt;li&gt;Satisfying the BGP export conditions&lt;/li&gt;
&lt;li&gt;Serving as a declaration that &quot;I own and advertise this prefix&quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is &lt;strong&gt;not&lt;/strong&gt; meant for real forwarding or local address binding by the Linux kernel.&lt;/p&gt;
&lt;p&gt;So it is reasonable to keep the &lt;code&gt;/47&lt;/code&gt; approach with &lt;code&gt;reject&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;actual-configuration-steps&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#actual-configuration-steps&quot;&gt;Actual Configuration Steps&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next, we start the Linux network configuration.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;step-1-create-the-new-dummy-interface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#step-1-create-the-new-dummy-interface&quot;&gt;Step 1: Create the New Dummy Interface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First load the module and create the logical interface:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;modprobe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; link&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; type&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; link&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; set&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; up&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;After execution, you can confirm with the following command:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; link&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;step-2-add-an-anchor-address-to-dummy47&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#step-2-add-an-anchor-address-to-dummy47&quot;&gt;Step 2: Add an anchor address to dummy47&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Although we will use the entire &lt;code&gt;/47&lt;/code&gt; address pool, it is still recommended to place an explicit single address on &lt;code&gt;dummy47&lt;/code&gt; as an &quot;anchor&quot;:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; addr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::1/128&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Using &lt;code&gt;/128&lt;/code&gt; is enough here. There is no need to add the entire &lt;code&gt;/47&lt;/code&gt; as a regular interface address.&lt;/p&gt;
&lt;h3 id=&quot;why-not-do-that&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#why-not-do-that&quot;&gt;Why not do that:&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; addr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Because this does not achieve the goal of &quot;the host can bind the entire &lt;code&gt;/47&lt;/code&gt;.&quot;&lt;br&gt;
It only gives the interface connected route semantics, which does not make the whole prefix a directly bindable local address pool.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;step-3-add-the-entire-47-as-a-local-route&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#step-3-add-the-entire-47-as-a-local-route&quot;&gt;Step 3: Add the entire &lt;code&gt;/47&lt;/code&gt; as a local route&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This step is the most critical.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; replace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; local&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; lo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;With this, the kernel will consider:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;2001:db8:4700::/47&lt;/code&gt; as a whole belonging to the host&apos;s local address space&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In other words, as long as applications later bind any IPv6 address within this range, the kernel will accept it.&lt;/p&gt;
&lt;h3 id=&quot;why-attach-it-to-lo&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#why-attach-it-to-lo&quot;&gt;Why attach it to &lt;code&gt;lo&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Because this is a &lt;strong&gt;local route&lt;/strong&gt;, which does not mean &quot;send packets from loopback&quot; but rather:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This prefix is treated as a local address&lt;/li&gt;
&lt;li&gt;It is held by the local host&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is the standard way Linux handles this kind of scenario.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;step-4-enable-ip_nonlocal_bind&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#step-4-enable-ip_nonlocal_bind&quot;&gt;Step 4: Enable ip_nonlocal_bind&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Even with &lt;code&gt;local route&lt;/code&gt; in place, many programs still by default cannot freely bind addresses that are not explicitly assigned to an interface.&lt;/p&gt;
&lt;p&gt;So you also need to enable:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;sysctl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -w&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; net.ipv6.ip_nonlocal_bind=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;For persistence, it is recommended to write it into a separate sysctl configuration file:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;cat&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; &gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;/etc/sysctl.d/99-ipv6-pool.conf&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; &amp;#x3C;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;EOF&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;net.ipv6.ip_nonlocal_bind = 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;sysctl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;step-5-reload-bird2&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#step-5-reload-bird2&quot;&gt;Step 5: Reload BIRD2&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If the BIRD configuration itself has not changed, this step is theoretically unnecessary.&lt;br&gt;
However, if you made any configuration adjustments along the way, reloading once is the safest option:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;birdc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; configure&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Then check whether the route is in the BIRD RIB:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;birdc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;verification&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#verification&quot;&gt;Verification&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;check-the-addresses-on-dummy47&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#check-the-addresses-on-dummy47&quot;&gt;Check the addresses on dummy47&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; addr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;You should see at least:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;inet6 2001:db8:4700::1/128 scope global&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;check-the-local-route&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#check-the-local-route&quot;&gt;Check the local route&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; table&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; local&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; grep&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &apos;2001:db8:4700::/47&apos;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;You should see something similar to:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;local 2001:db8:4700::/47 dev lo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;test-outbound-connectivity-using-a-specified-source-ipv6-address&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#test-outbound-connectivity-using-a-specified-source-ipv6-address&quot;&gt;Test outbound connectivity using a specified source IPv6 address&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Do not specify the interface name &lt;code&gt;dummy47&lt;/code&gt; here; instead, bind directly to the specific source address:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::200&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4701::1234&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;If the returned values are the source addresses you specified, the configuration is successful.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;a-pitfall-to-watch-out-for-binding-to-an-interface-is-not-the-same-as-binding-to-a-source-address&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#a-pitfall-to-watch-out-for-binding-to-an-interface-is-not-the-same-as-binding-to-a-source-address&quot;&gt;A pitfall to watch out for: binding to an &quot;interface&quot; is not the same as binding to a &quot;source address&quot;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Many people instinctively test it like this:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;This testing method is not suitable here.&lt;/p&gt;
&lt;p&gt;This is because &lt;code&gt;dummy47&lt;/code&gt; is not a physical egress NIC; it is just a logical carrier interface.&lt;br&gt;
Actual outbound traffic still depends on the system default route, which generally goes out through a real physical NIC such as &lt;code&gt;eth0&lt;/code&gt; or &lt;code&gt;ens3&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So the correct approach is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bind to the specific source IPv6 address&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;rather than binding to the &lt;code&gt;dummy47&lt;/code&gt; interface name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That is:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;about-ndppd-generally-not-needed-in-this-scenario&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#about-ndppd-generally-not-needed-in-this-scenario&quot;&gt;About ndppd: generally not needed in this scenario&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some articles on &quot;binding and directly using an entire IPv6 range&quot; additionally mention &lt;code&gt;ndppd&lt;/code&gt;.&lt;br&gt;
That is usually because the upstream provides the IPv6 prefix to the machine as an &lt;strong&gt;on-link network&lt;/strong&gt;, requiring NDP neighbor discovery for each address.&lt;/p&gt;
&lt;p&gt;But the scenario here is different:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The machine already advertises this prefix via &lt;strong&gt;BGP&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;The upstream is more like &lt;strong&gt;routing this prefix to this machine&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;rather than requiring the host to respond to NDP for each address across the whole range at Layer 2&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So in this design, generally:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ndppd&lt;/code&gt; is not needed&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;You only need:
&lt;ul&gt;
&lt;li&gt;BIRD to advertise the prefix normally&lt;/li&gt;
&lt;li&gt;The kernel to have &lt;code&gt;local route&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ip_nonlocal_bind&lt;/code&gt; to be enabled&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Only when the provider explicitly requires that this prefix be Layer 2 directly connected and that neighbor discovery be performed for target addresses should you additionally consider &lt;code&gt;ndppd&lt;/code&gt; or &lt;code&gt;proxy_ndp&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;persistence-solution-systemd-service&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#persistence-solution-systemd-service&quot;&gt;Persistence solution: systemd service&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To avoid losing the configuration after a reboot, I finally wrote this setup into a simple systemd service.&lt;/p&gt;
&lt;p&gt;Create the file:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;vim&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; /etc/systemd/system/dummy47-v6pool.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The content is as follows:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;ini&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;ini&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;ini&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;[Unit]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;Description&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=IPv6 pool on dummy47&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;After&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=network-online.target&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;Wants&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=network-online.target&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;[Service]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;Type&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=oneshot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;RemainAfterExit&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/modprobe dummy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip link add dummy47 type dummy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip link set dummy47 up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip -6 addr add 2001:db8:4700::1/128 dev dummy47&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip -6 route replace local 2001:db8:4700::/47 dev lo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/sysctl -w &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;net.ipv6.ip_nonlocal_bind&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStop&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip -6 route del local 2001:db8:4700::/47 dev lo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStop&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip -6 addr del 2001:db8:4700::1/128 dev dummy47&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;ExecStop&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=/sbin/ip link del dummy47&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;[Install]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;WantedBy&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=multi-user.target&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Then run:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;systemctl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; daemon-reload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;systemctl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; enable&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --now&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47-v6pool.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;a-summary-of-the-complete-operation-commands&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#a-summary-of-the-complete-operation-commands&quot;&gt;A summary of the complete operation commands&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;For easy copying, the full steps are summarised here in one block:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;modprobe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; link&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; type&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; ||&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; link&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; set&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; addr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::1/128&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; ||&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; replace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; local&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; lo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;sysctl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -w&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; net.ipv6.ip_nonlocal_bind=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;birdc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; configure&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;birdc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::/47&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Verification:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;bash&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; addr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dev&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; dummy47&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; table&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; local&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; grep&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &apos;2001:db8:4700::/47&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4700::200&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; -6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --interface&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; 2001:db8:4701::1234&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; https://ipv6.ip.sb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;my-final-understanding&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#my-final-understanding&quot;&gt;My final understanding&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;After completing this configuration, the overall structure becomes very clear:&lt;/p&gt;
&lt;h3 id=&quot;what-bird2-does&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#what-bird2-does&quot;&gt;What BIRD2 does&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Continues to advertise the target &lt;code&gt;/47&lt;/code&gt; via BGP&lt;/li&gt;
&lt;li&gt;Continues to place the prefix into the BIRD RIB using &lt;code&gt;static ... reject&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Does not import or export Linux kernel routes&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;what-the-linux-kernel-does&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#what-the-linux-kernel-does&quot;&gt;What the Linux kernel does&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Provides the logical carrier via &lt;code&gt;dummy47&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Marks the entire &lt;code&gt;/47&lt;/code&gt; as local address space via &lt;code&gt;local route&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Allows applications to bind any IPv6 address in the pool via &lt;code&gt;ip_nonlocal_bind&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;how-applications-use-it&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#how-applications-use-it&quot;&gt;How applications use it&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Do not bind to &lt;code&gt;dummy47&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Instead, bind to a specific IPv6 address within the target &lt;code&gt;/47&lt;/code&gt; as the source address&lt;/li&gt;
&lt;li&gt;Traffic still ultimately follows the system default route and exits through the real physical interface&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;afterword&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/bird2-ipv6-pool-sanitized/#afterword&quot;&gt;Afterword&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At first, I also easily confused &quot;prefix advertisement&quot; with &quot;local address binding&quot; as one and the same thing.&lt;br&gt;
But once I separated them, it became clear that these are actually two different layers of concern:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Control plane for routing&lt;/strong&gt;: BIRD/BGP&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data plane on the host&lt;/strong&gt;: Linux network stack&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With these two handled separately, the overall setup becomes very stable and is easier to maintain and troubleshoot.&lt;/p&gt;
&lt;p&gt;If I later expand this machine to host more IPv6 address pools, I would prioritize continuing with this approach:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;BIRD is only responsible for advertising&lt;/li&gt;
&lt;li&gt;The business address pool is managed through &lt;code&gt;dummy + local route + ip_nonlocal_bind&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This keeps the structure the cleanest.&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>bird2</category><category>ipv6</category><category>linux</category><category>bgp</category><category>网络</category></item><item><title>Hands-on Notes on AWS Services and a Kafka Cluster</title><link>https://blog.xsy.fun/en/posts/kafka-experience/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/kafka-experience/</guid><description>Hands-on notes from a first AWS project: a data flow wired together from IoT Core, MSK Kafka, Lambda, S3 and IAM permissions.</description><pubDate>Thu, 12 Jun 2025 15:41:55 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;introduction&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A recent project of mine needed AWS services. Since this was my first time getting hands-on with AWS and its services, I thought it worth writing a post to record the technologies I came across, some of my understanding and takeaways, and a few real operations, so that I can look back and reuse some of the commands.&lt;/p&gt;
&lt;p&gt;The project involved&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Amazon MSK, i.e. Fully Managed Apache Kafka — put simply, a Kafka cluster&lt;/li&gt;
&lt;li&gt;Amazon IoT Core, something similar to an MQTT broker&lt;/li&gt;
&lt;li&gt;Amazon Lambda, a serverless platform that supports many programming languages&lt;/li&gt;
&lt;li&gt;Amazon S3, Scalable Storage in the Cloud&lt;/li&gt;
&lt;li&gt;Amazon IAM for access control&lt;/li&gt;
&lt;li&gt;Amazon CloudWatch - a platform similar to Grafana&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This journal walks through the services above and chains them all into one data flow&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;walkthrough&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#walkthrough&quot;&gt;Walkthrough&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;business-flow&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#business-flow&quot;&gt;Business flow&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We start where the data enters and follow it step by step, tying together every service it passes through.&lt;/p&gt;
&lt;p&gt;IoT Core is the entry point: it accepts data from IoT devices or other services that speak MQTT, and uses the Rules feature of Message routing to forward it to a Kafka topic, or to send it to Lambda, which processes it and writes it into JSON files on S3.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img alt=&quot;&quot; sizes=&quot;(min-width: 864px) 832px, 100vw&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1288&quot; height=&quot;344&quot; src=&quot;https://blog.xsy.fun/_astro/chart.BXZSZmvX_Zn5uoX.webp&quot; srcset=&quot;https://blog.xsy.fun/_astro/chart.BXZSZmvX_2ct5ky.webp 640w, https://blog.xsy.fun/_astro/chart.BXZSZmvX_Z3F7N3.webp 750w, https://blog.xsy.fun/_astro/chart.BXZSZmvX_Z1Hvz7r.webp 828w, https://blog.xsy.fun/_astro/chart.BXZSZmvX_Z2pkx6I.webp 1080w, https://blog.xsy.fun/_astro/chart.BXZSZmvX_ZjvvEG.webp 1280w, https://blog.xsy.fun/_astro/chart.BXZSZmvX_Zn5uoX.webp 1288w&quot;&gt;&lt;/figure&gt;
&lt;figure class=&quot;diagram&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;pre class=&quot;mermaid&quot; data-source=&quot;graph LR
A[mqtt message]-- Message Rule ---&gt;B[Kafka Cluster topic]
A-- Message Rule ---&gt;C[Lambda - Process Data] ---&gt; D[S3]&quot;&gt;graph LR
A[mqtt message]-- Message Rule ---&gt;B[Kafka Cluster topic]
A-- Message Rule ---&gt;C[Lambda - Process Data] ---&gt; D[S3]&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;iam-access-control&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#iam-access-control&quot;&gt;IAM access control&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When IoT Core runs into an error, it writes the log to CloudWatch. To make all of this work, you first configure Policies for several services and assign them to various Roles; the services then use the permissions a Role grants to operate on other AWS services. In short, a Policy is a set of individual permissions — s3:ListBucket, for example, is one of the permissions in a Policy.&lt;/p&gt;
&lt;p&gt;A Role, in turn, is a set of one or more Policies: an S3 Admin Policy and a CloudWatch Write Policy, for example, become the Policies of a Role. Only when a Role with the right permissions is assigned to an instance of an AWS service can that instance operate on and access resources — a key prerequisite.&lt;/p&gt;
&lt;h3 id=&quot;msk-configuration&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#msk-configuration&quot;&gt;MSK configuration&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;MSK comes in two types, Provisioned and Serverless, and &lt;strong&gt;Serverless supports no authentication method other than IAM&lt;/strong&gt;. So if you want IoT Core to work with MSK, you must use the provisioned version, because IoT Core rules only support SASL/SCRAM or SSL authentication.&lt;/p&gt;
&lt;p&gt;There are several ways to reach the nodes of the MSK cluster from outside to create topics. I used an EC2 client machine — a virtual machine acting as a jump host — and ran a proxy on it, so that from outside I could connect through the proxy to nodes inside Amazon on the same VPC network as the EC2 instance. One very important point: &lt;strong&gt;do not overlook whether the MSK and EC2 firewall rules let the traffic through; if they do not, you cannot connect&lt;/strong&gt;. I spent a long time troubleshooting here before finding out it was the firewall&lt;/p&gt;
&lt;p&gt;For how to set up the jump host, see the official documentation &lt;a href=&quot;https://docs.aws.amazon.com/msk/latest/developerguide/create-client-machine.html&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;https://docs.aws.amazon.com/msk/latest/developerguide/create-client-machine.html&lt;/a&gt;&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img alt=&quot;firewall example&quot; sizes=&quot;(min-width: 864px) 832px, 100vw&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2778&quot; height=&quot;616&quot; src=&quot;https://blog.xsy.fun/_astro/firewall.XWH4oXXv_Z1kat7i.webp&quot; srcset=&quot;https://blog.xsy.fun/_astro/firewall.XWH4oXXv_1MU77U.webp 640w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_Z1zRx32.webp 750w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_PMRDa.webp 828w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_ZaeDuO.webp 1080w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_ZmgObE.webp 1280w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_23OIk6.webp 1668w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_Z1x3JyB.webp 2048w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_1jzJYu.webp 2560w, https://blog.xsy.fun/_astro/firewall.XWH4oXXv_Z1kat7i.webp 2778w&quot;&gt;&lt;/figure&gt;
&lt;p&gt;With access covered, let us go deeper into connections and permissions. First make sure the IAM Role of the EC2 instance may access the nodes and topics of the MSK cluster; then, on the jump host, the following commands create a topic, subscribe to it and send messages to it&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;console&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;console&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;console&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;# subscribe topic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;./kafka-console-consumer.sh \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --bootstrap-server url:port,url2:port \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --topic topic \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --consumer.config client.properties&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;# push data to topic, producer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;./kafka-console-producer.sh \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --bootstrap-server url:port,url2:port \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --topic topic \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --producer.config client.properties&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;# check all the topic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;./kafka-topics.sh --list \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --bootstrap-server url:port,url2:port \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --consumer.config sasl.properties&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;# create a topic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;./kafka-topics.sh --create \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --bootstrap-server url:port,url2:port \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --topic topic \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --partitions 6 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;  --replication-factor 2 \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; --command-config sasl.properties&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;If you see something like Error while executing topic command : The AdminClient thread has exited. Call: createTopics, it is almost certainly a permissions problem: first check that your IAM and SASL/SCRAM/SSL settings are correct. For IAM on EC2, as long as the IAM role is configured correctly in the console, that IP can connect directly with IAM.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;console&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;console&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;console&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;[ec2-user@ bin]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$ ./kafka-topics.sh --create --bootstrap-server url:port --topic your_topic --partitions 6 --replication-factor 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;WARNING: Due to limitations in metric names, topics with a period (&apos;.&apos;) or underscore (&apos;&apos;) could collide. To avoid issues it is best to use either, but not both.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;Error while executing topic command : The AdminClient thread has exited. Call: createTopics&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;[2025-06-11 05:00:49,875] ERROR org.apache.kafka.common.errors.TimeoutException: The AdminClient thread has exited. Call: createTopics&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; (org.apache.kafka.tools.TopicCommand)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;[2025-06-11 05:00:49,890] ERROR Uncaught exception in thread &apos;kafka-admin-client-thread | adminclient-1&apos;: (org.apache.kafka.common.utils.KafkaThread)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;java.lang.OutOfMemoryError: Java heap space&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at java.base/java.nio.HeapByteBuffer.&amp;#x3C;init&gt;(HeapByteBuffer.java:61)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:348)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.memory.MemoryPool$1.tryAllocate(MemoryPool.java:30)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:103)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:462)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:412)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:694)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:596)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.common.network.Selector.poll(Selector.java:501)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:596)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.processRequests(KafkaAdminClient.java:1542)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1473)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        at java.base/java.lang.Thread.run(Thread.java:829)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;iot-core-setup&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#iot-core-setup&quot;&gt;IoT Core setup&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Open AWS IoT - Message routing - Rules to add a new rule. Here I record how I used a Rule to forward data to Kafka. First choose Kafka as the Rule action and add a VPC under Destination, which again needs a matching IAM Role. Then set the Kafka topic to the topic you created earlier. For the Key I entered ${clientid()}, mainly so that Kafka can partition the data; if one key carries too much, a single partition may end up with too much content and become skewed.&lt;/p&gt;
&lt;p&gt;Pay special attention to the SASL Configuration: the username and password must first be stored as a key-value pair in AWS Secrets Manager and bound to a key generated in Key Management Service (KMS). Later, when you connect with SASL/SCRAM, the key-value pair set here is your username and password&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img alt=&quot;alt text&quot; sizes=&quot;(min-width: 864px) 832px, 100vw&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1986&quot; height=&quot;1588&quot; src=&quot;https://blog.xsy.fun/_astro/secrets.BukECRdb_1ESl7f.webp&quot; srcset=&quot;https://blog.xsy.fun/_astro/secrets.BukECRdb_1xEe9N.webp 640w, https://blog.xsy.fun/_astro/secrets.BukECRdb_Z1g1I3x.webp 750w, https://blog.xsy.fun/_astro/secrets.BukECRdb_ZpktBj.webp 828w, https://blog.xsy.fun/_astro/secrets.BukECRdb_ZbdwRm.webp 1080w, https://blog.xsy.fun/_astro/secrets.BukECRdb_Z1gb4cz.webp 1280w, https://blog.xsy.fun/_astro/secrets.BukECRdb_26s2qa.webp 1668w, https://blog.xsy.fun/_astro/secrets.BukECRdb_1ESl7f.webp 1986w&quot;&gt;&lt;/figure&gt;
&lt;p&gt;Then we use the following to read the value stored in Secrets Manager. This one is the username; for the password, simply replace username
&lt;code&gt; ${get_secret(&apos;AmazonMSK_iot&apos;, &apos;SecretString&apos;, &apos;username&apos;, &apos;you role arn&apos;)}&lt;/code&gt;
You can of course set some headers to make messages easier to identify, but too many may slightly affect performance&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img alt=&quot;alt text&quot; sizes=&quot;(min-width: 864px) 832px, 100vw&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1968&quot; height=&quot;692&quot; src=&quot;https://blog.xsy.fun/_astro/headers.Bz7JxUWd_1TGk04.webp&quot; srcset=&quot;https://blog.xsy.fun/_astro/headers.Bz7JxUWd_pQGNK.webp 640w, https://blog.xsy.fun/_astro/headers.Bz7JxUWd_Z2g9jH2.webp 750w, https://blog.xsy.fun/_astro/headers.Bz7JxUWd_1nJvNa.webp 828w, https://blog.xsy.fun/_astro/headers.Bz7JxUWd_Z25GGWA.webp 1080w, https://blog.xsy.fun/_astro/headers.Bz7JxUWd_ZhoOYI.webp 1280w, https://blog.xsy.fun/_astro/headers.Bz7JxUWd_1RQO7P.webp 1668w, https://blog.xsy.fun/_astro/headers.Bz7JxUWd_1TGk04.webp 1968w&quot;&gt;&lt;/figure&gt;
&lt;h3 id=&quot;lambda-setup&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#lambda-setup&quot;&gt;Lambda setup&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Just add a Function in Lambda, then give the IoT Core rule an action pointing to that function, and the IoT data is sent there too. In the function I merge the MQTT data it receives and upload it to S3. If the IoT Core rule forwarded the data straight to S3, it would create one file per message, which is inconvenient to manage and inspect — that is why Lambda does the forwarding here.&lt;/p&gt;
&lt;p&gt;However, since Lambda uploads the data to S3 directly without any buffering, a large volume of data might cause problems&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;conclusion&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/kafka-experience/#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;That is every AWS service I have picked up recently. If anything new comes along, I will add it later&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>AWS</category><category>Kafka</category><category>IAM</category><category>MQTT</category><category>S3</category></item><item><title>Migrating Typecho Posts to Hexo</title><link>https://blog.xsy.fun/en/posts/hello-world/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/hello-world/</guid><description>How a single Python script moves a Typecho blog&apos;s posts and tags to Hexo, and what happens to comments and images along the way.</description><pubDate>Sun, 03 Nov 2024 09:24:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/hello-world/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Migrating my Typecho posts to Hexo: it has been far too long, but I have finally picked my blog up again. The last time I wrote anything here was five years ago, and in the blink of an eye I am about to graduate from university. Looking back, the &quot;Ten-Year Pact&quot; blog project I joined back then was a bit of a joke — keeping a server paid for year after year is not cheap. Still, now that I am older and know more, this blog should be able to make it to ten years.&lt;/p&gt;
&lt;p&gt;Enough rambling. This post is about how I moved my blog from Typecho to Hexo. It is actually simple — a single Python file does the job — but switching comment systems makes the old comments hard to carry over, so I had to make trade-offs. For now I have migrated all the posts and mapped their tags; as for images, I used object storage from the start, so they should be fine.&lt;/p&gt;
&lt;p&gt;Here is the code:&lt;/p&gt;
&lt;h3 id=&quot;migration-code&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/hello-world/#migration-code&quot;&gt;Migration code&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;python&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;python&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;# -*- coding: utf-8 -*-&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; pymysql&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; arrow&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; box &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; Box&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; create_data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(db):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    cursor &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; db.cursor()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;    # 创建文章&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    cursor.execute(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;select cid, title, slug, text, created, modified from ty_contents where type=&apos;post&apos;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;    # 创建分类和标签&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    entries &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; cursor.fetchall()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; e &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; entries:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        e &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; Box(e)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        title &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; e.title&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        title &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; title.strip(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos; &apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        print&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(title)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        content &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(e.text).replace(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;&amp;#x3C;!--markdown--&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;        # 文章太长截断&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        max_length &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; 150&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;  # Set the maximum content length here&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(content) &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; max_length:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;            content &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; content[:max_length] &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&amp;#x3C;!--more--&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; content[max_length:]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        tags &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        cursor.execute(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;select type, name, slug from `ty_relationships` ts, ty_metas tm where tm.mid = ts.mid and ts.cid = &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; %&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; e.cid)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        metas &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; cursor.fetchall()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;        for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; m &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; metas:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;            m &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; Box(m)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;            if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; m.type &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &apos;tag&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;                tags.append(m.name)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        path &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &apos;data/_posts/&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; not&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; os.path.exists(path):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;            os.makedirs(path)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        filename &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; arrow.get(e.created).format(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;YYYY-MM-DD&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; title.replace(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;-&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; open&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;filename&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.md&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;w&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#E36209;--shiki-dark:#FFAB70&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;---&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;title: &apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; %&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; title)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;date: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;%s\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; %&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; arrow.get(e.created).format(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;YYYY-MM-DD HH:mm:ss&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;updated: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;%s\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; %&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; arrow.get(e.modified).format(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;YYYY-MM-DD HH:mm:ss&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;tags: [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; %&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &apos;,&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;.join(tags))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;published: true&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;lang: zh-cn&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;---&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.write(content)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        f.close()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; main&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;    # 把数据库连接信息&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    db &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; pymysql.connect(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E36209;--shiki-dark:#FFAB70&quot;&gt;host&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;localhost&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E36209;--shiki-dark:#FFAB70&quot;&gt;                                 user&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;root&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E36209;--shiki-dark:#FFAB70&quot;&gt;                                 password&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;xxxxx&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E36209;--shiki-dark:#FFAB70&quot;&gt;                                 database&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;typecho&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E36209;--shiki-dark:#FFAB70&quot;&gt;                                 cursorclass&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;pymysql.cursors.DictCursor)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    create_data(db)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; __name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &quot;__main__&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    main()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Not all of this code is my own: I found it online and adapted it to my setup. If you need to migrate more, feel free to modify it yourself.&lt;/p&gt;
&lt;h3 id=&quot;closing-thoughts&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/hello-world/#closing-thoughts&quot;&gt;Closing thoughts&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I am finally back. From the flashy themes of my younger days to chasing page speed and a clean design today — quite a change.&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>Hexo</category><category>Typecho</category><category>数据迁移</category><category>Python</category><category>博客</category></item><item><title>Adding Two-Step Verification to Typecho</title><link>https://blog.xsy.fun/en/posts/2020-05-16-wei-typecho-tian-jia-liang-bu-yan-zheng/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2020-05-16-wei-typecho-tian-jia-liang-bu-yan-zheng/</guid><description>A guide to installing the Google Authenticator plugin for a Typecho blog and binding a two-step verification client to improve the security of admin login.</description><pubDate>Sat, 16 May 2020 20:23:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;foreword&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-05-16-wei-typecho-tian-jia-liang-bu-yan-zheng/#foreword&quot;&gt;Foreword&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Today I discovered a very handy app, Google&apos;s Authenticator. It is a two-step verification client based on time and hash algorithms, and it complies with the RFC 6238 and RFC 4226 standards. Since the security of a blog is still very important, after all it concerns the server, two-step verification is quite necessary here. Conveniently, Typecho has a Google Authenticator plugin, open-sourced on GitHub. Those who question its security can review it themselves: &lt;a href=&quot;https://github.com/naicfeng/typecho-Authenticator&quot; title=&quot;Project address&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;project address&lt;/a&gt;&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;usage&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-05-16-wei-typecho-tian-jia-liang-bu-yan-zheng/#usage&quot;&gt;Usage&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Rename the file to GAuthenticator, place it in the /usr/plugins directory, and then enable it in the admin panel.&lt;/p&gt;
&lt;p&gt;The plugin is disabled by default. When you enable it for the first time, you need to scan the QR code to bind it, then enter the code displayed on your phone. It can only be enabled after the verification succeeds.&lt;/p&gt;
&lt;h4 id=&quot;download-link-here-click-me&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-05-16-wei-typecho-tian-jia-liang-bu-yan-zheng/#download-link-here-click-me&quot;&gt;Download link here: &lt;/a&gt;&lt;a href=&quot;https://github.com/naicfeng/typecho-Authenticator/releases&quot; title=&quot;github&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;click me&lt;/a&gt;&lt;/h4&gt;
&lt;h3 id=&quot;installing-the-client&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-05-16-wei-typecho-tian-jia-liang-bu-yan-zheng/#installing-the-client&quot;&gt;Installing the Client&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Compatible with any AuthOTP software that conforms to the &lt;a href=&quot;https://tools.ietf.org/html/rfc6238&quot; title=&quot;rfc6238&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;RFC6238&lt;/a&gt; specification:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Microsoft Authenticator&lt;/li&gt;
&lt;li&gt;Google Authenticator&lt;/li&gt;
&lt;li&gt;1Password&lt;/li&gt;
&lt;li&gt;Authy&lt;/li&gt;
&lt;li&gt;KeePass&lt;/li&gt;
&lt;li&gt;LastPass&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here, I personally use Google&apos;s Authenticator. It takes up relatively little system resources and is simple and convenient.&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>Typecho</category><category>网络安全</category><category>两步验证</category><category>博客</category></item><item><title>Building a Mini Program Version of Typecho</title><link>https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/</guid><description>A guide to setting up and modifying a WeChat Mini Program version of a Typecho blog based on the WeChat-Typecho project, covering domain configuration, plugin settings, and page customization.</description><pubDate>Mon, 20 Apr 2020 18:35:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;foreword&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#foreword&quot;&gt;Foreword&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Recently I&apos;ve seen quite a few bloggers publish WeChat Mini Program versions of Typecho, but the quality varies. Some open-source ones have unattractive interfaces, and the attractive ones charge fees. Being frugal, after trying many projects on GitHub, I finally found one that actually runs. Setting aside what the interface looks like, at least it runs. Other projects had more or less problems with my theme, though that may have been debugging issues on my side. After all, it was my first time touching WeChat Mini Programs, and at first I wasn&apos;t very familiar with how the project is built. Only after spending more time did I gradually figure out the specific steps. Precisely because the open-source program&apos;s interface isn&apos;t very attractive, and because it&apos;s difficult for them to work with the handsome theme (for example, the loss of header images and post excerpts), I chose to modify the front-end pages on top of a version that runs.&lt;/p&gt;
&lt;h3 id=&quot;project-address&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#project-address&quot;&gt;Project Address&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/xsy2004/WeChat-Typecho&quot; title=&quot;WeChat-Typecho&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;WeChat-Typecho&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please, dear experts, give it a Star, I&apos;m humbly begging&lt;/p&gt;
&lt;h4 id=&quot;scan-to-preview&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#scan-to-preview&quot;&gt;Scan to Preview&lt;/a&gt;&lt;/h4&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;a href=&quot;https://cdn.xsiy.ltd/photo/cid178/cxm.jpg&quot; title=&quot;Mini Program Code&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/cid178/cxm.jpg&quot; alt=&quot;Mini Program Code&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/a&gt;&lt;figcaption&gt;Mini Program Code&lt;/figcaption&gt;&lt;/figure&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;special-thanks&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#special-thanks&quot;&gt;Special Thanks&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I put acknowledgements at the very beginning because I&apos;m also a &lt;del&gt;coder&lt;/del&gt; humble programmer myself, so I deeply understand how hard writing code is, and I would like to express special thanks here&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/MingliangLu/WeTypecho&quot; title=&quot;WeTypecho&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;WeTypecho&lt;/a&gt;——Expert from Chengdu, the &quot;Seventh Handsome,&quot; author of the blog-side plugin&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://gitee.com/Byclemon/Pisces-Mini-Program&quot; title=&quot;Pisces-Mini-Program&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;Pisces-Mini-Program&lt;/a&gt;——Modified by the author based on WeTypecho&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/weilanwl/ColorUI&quot; title=&quot;ColorUI&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;ColorUI&lt;/a&gt;——CSS library for Mini Programs&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;notes&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#notes&quot;&gt;Notes&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Why didn&apos;t I choose other authors&apos; projects on GitHub?&lt;/p&gt;
&lt;p&gt;Because I want my WeChat Mini Program to not only allow browsing but also interaction, so users can use the Mini Program to comment and express their views and thoughts on articles. If in the future I have the ability to write back-end JS, I will improve the projects on GitHub that I think look good.&lt;/p&gt;
&lt;p&gt;For example, &lt;a href=&quot;https://github.com/loveempathy/WxappForTypecho&quot; title=&quot;WxappForTypecho&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;WxappForTypecho&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&quot;the-letter-based-function-naming-in-the-project-was-not-written-by-me&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#the-letter-based-function-naming-in-the-project-was-not-written-by-me&quot;&gt;The letter-based function naming in the project was not written by me!!!&lt;/a&gt;&lt;/h4&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;mini-program-publishing-requirements&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#mini-program-publishing-requirements&quot;&gt;Mini Program Publishing Requirements&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Domain name has been registered with ICP filing&lt;/li&gt;
&lt;li&gt;Domain name has HTTPS enabled&lt;/li&gt;
&lt;li&gt;Be an adult, or have a WeChat payment-linked account for users 18 and over&lt;/li&gt;
&lt;/ol&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;a href=&quot;https://cdn.xsiy.ltd/photo/cid178/1.png&quot; title=&quot;WeChat Domain Configuration&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/cid178/1.png&quot; alt=&quot;WeChat Domain Configuration&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/a&gt;&lt;figcaption&gt;WeChat Domain Configuration&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Add your domain to it. If your image and other resources are stored at an address that is not the domain you set above,&lt;/p&gt;
&lt;p&gt;you also need to add your image resource domain, otherwise the Mini Program may be unable to display resources.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;features&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#features&quot;&gt;Features&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The currently supported basic features are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Browse articles by category directory&lt;/li&gt;
&lt;li&gt;Display of the About personal page&lt;/li&gt;
&lt;li&gt;Homepage article carousel&lt;/li&gt;
&lt;li&gt;Comment on articles&lt;/li&gt;
&lt;li&gt;Automatically fetch article header images&lt;/li&gt;
&lt;li&gt;Display of images and videos&lt;/li&gt;
&lt;li&gt;Support for Markdown and HTML parsing&lt;/li&gt;
&lt;li&gt;Recommended reading articles&lt;/li&gt;
&lt;li&gt;Search articles&lt;/li&gt;
&lt;li&gt;Custom character display of different card styles&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;custom-characters&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#custom-characters&quot;&gt;Custom Characters&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;style (display style of homepage articles, default value is 3, I haven&apos;t tested the others)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Large image card form for code&lt;/li&gt;
&lt;li&gt;Small image card display form for representative&lt;/li&gt;
&lt;li&gt;Background card form for representative&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;isPay (whether the article requires an ad launch, default is 0) 1: Yes 0: No&lt;/p&gt;
&lt;p&gt;thumb (article thumbnail)&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;tutorial&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#tutorial&quot;&gt;Tutorial&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On line 236 of &lt;code&gt;/common/vendor.js&lt;/code&gt;, modify your information. I didn&apos;t write this function naming convention, so don&apos;t hit me.&lt;/p&gt;
&lt;p&gt;When debugging in the WeChat Developer Tools, you need to check the options in Details: &quot;Do not validate legal domains&quot; and &quot;web-view&quot;, otherwise articles won&apos;t display during debugging.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Modify r and i and make them correspond with the back-end Mini Program&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/cid178/2.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;On line 6 and line 8 of &lt;code&gt;/pages/about/home/home.wxml&lt;/code&gt;, modify your blog name and description.&lt;/p&gt;
&lt;p&gt;On the third line of &lt;code&gt;/pages/index/index.wxml&lt;/code&gt;, modify the name at the very top of the Mini Program.&lt;/p&gt;
&lt;p&gt;On line 57 of &lt;code&gt;/pages/index/index.js&lt;/code&gt;, modify the author information under each article.&lt;/p&gt;
&lt;p&gt;On line 16 of &lt;code&gt;/app.json&lt;/code&gt;, modify your blog name.&lt;/p&gt;
&lt;p&gt;On line 2 of &lt;code&gt;/pages/about/home/home.wxss&lt;/code&gt;, modify the avatar address on the About page.&lt;/p&gt;
&lt;p&gt;On line 4 of &lt;code&gt;/pages/about/home/home.wxml&lt;/code&gt;, modify the avatar address.&lt;/p&gt;
&lt;p&gt;On &lt;code&gt;/pages/about/home/home.js第73&lt;/code&gt; and line 74, modify the image address of the WeChat reward code.&lt;/p&gt;
&lt;p&gt;On line 157 of &lt;code&gt;/pages/details/details.wxml&lt;/code&gt;, modify the image that appears after you like something; anyway, modify it yourself.&lt;/p&gt;
&lt;h3 id=&quot;typecho-plugin-side&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#typecho-plugin-side&quot;&gt;Typecho Plugin Side&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Copy &lt;code&gt;WeTypecho&lt;/code&gt; to the plugin directory, then activate and configure it in the backend. The name must be correct, otherwise an error will occur.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;APISEC&lt;/li&gt;
&lt;li&gt;Blog author name&lt;/li&gt;
&lt;li&gt;Blog URL&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These three items are required; the rest is optional (I guess).&lt;/p&gt;
&lt;p&gt;It must be consistent with the API_SECRET field in the Mini Program side config.js, otherwise data cannot be read from the server.&lt;/p&gt;
&lt;h3 id=&quot;code-explanation&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-20-xiao-cheng-xu-ban-typecho-gou-jian/#code-explanation&quot;&gt;Code Explanation&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;app.js is the initial entry file. wxss is equivalent to CSS in an HTML project. If you add new code in js, you need to declare it in the json file.&lt;/p&gt;
&lt;p&gt;static is where resource files are placed. You can modify the materials yourself, but it seems not all of them are referenced, so look around on your own.&lt;/p&gt;
&lt;p&gt;pages contains all the pages, which can be referenced and navigated to. For example, to jump to the About page, the address is &lt;code&gt;pages/about/home/home&lt;/code&gt; about under the home directory&apos;s home method, roughly speaking. I&apos;m also touching WeChat Mini Programs for the first time..&lt;/p&gt;
&lt;p&gt;This project introduces Color UI. You can download the demo and &lt;del&gt;copy&lt;/del&gt; write your own.&lt;/p&gt;
&lt;p&gt;Below line 26 of /pages/index/index.js is where you modify the two jump buttons on the homepage.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;	categories: [{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		cuIcon: &quot;write&quot;,//这个是图标，可以自己去color ui的小程序找名称修改&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		color: &quot;white&quot;,//这个是文字颜色&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		bg_color: &quot;bg-gradual-green&quot;,//这个是背景颜色，可自行修改&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		badge: 1,//小红点文章个数，填1就是一个小红点，大于1就是显示数字，大于99显示99+&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		mid: &quot;24&quot;,//这个是分类id&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		title: &quot;随笔&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;		name: &quot;Essay&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;	}，&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;You can add parameters yourself. The calling method is as follows &lt;code&gt;{{item.title}}&lt;/code&gt;. You must declare &lt;code&gt;wx:for=&quot;{{categories}}&quot;&lt;/code&gt; before use.&lt;/p&gt;
&lt;p&gt;Please reward me&lt;img src=&quot;https://cdn.xsiy.ltd/wxxcx/zsm.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>Typecho</category><category>微信小程序</category><category>前端</category><category>博客</category></item><item><title>How to Turn an Entire Website Grayscale and the CSS Code to Implement It</title><link>https://blog.xsy.fun/en/posts/2020-04-04-wang-zhan-quan-ju-bian-hui-cao-zuo-fang-shi-ji-shi-xian-css-dai-ma/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2020-04-04-wang-zhan-quan-ju-bian-hui-cao-zuo-fang-shi-ji-shi-xian-css-dai-ma/</guid><description>This article explains how to use the CSS grayscale filter to make the whole website grayscale, and provides code compatible with mainstream browsers and legacy IE.</description><pubDate>Sat, 04 Apr 2020 08:24:00 GMT</pubDate><content:encoded>&lt;br&gt;
&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-04-wang-zhan-quan-ju-bian-hui-cao-zuo-fang-shi-ji-shi-xian-css-dai-ma/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To express the deep mourning of the people of all ethnic groups for the martyrs who sacrificed themselves and the compatriots who died in the fight against the COVID-19 epidemic, the State Council has decided to hold a national mourning day on April 4, 2020.&lt;/p&gt;
&lt;p&gt;In response to the General Office of the State Council&apos;s notice on holding a national mourning event for the martyrs and compatriots who died in the COVID-19 epidemic, and in accordance with requests from some of our clients, we turned some client websites black and white from 0:00 to 24:00 on April 4. At the same time, the official website of Weijie is also being turned grey in sync, to mourn the martyrs and compatriots who died in the fight against the COVID-19 epidemic. Below is a brief description of how to turn a website grey.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;main-text&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-04-wang-zhan-quan-ju-bian-hui-cao-zuo-fang-shi-ji-shi-xian-css-dai-ma/#main-text&quot;&gt;Main Text&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;css-method&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-04-04-wang-zhan-quan-ju-bian-hui-cao-zuo-fang-shi-ji-shi-xian-css-dai-ma/#css-method&quot;&gt;CSS Method&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Add a line of style in the head section of the page that needs to be turned grey.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; type&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;text/css&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;html {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;-webkit-filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;grayscale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);}&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The above code works with mainstream browsers, such as the latest versions of Chrome and Edge.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;    html&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        -webkit-filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;grayscale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        -moz-filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;grayscale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        -ms-filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;grayscale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        -o-filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;grayscale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;        filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;:progid:DXImageTransform.Microsoft.BasicImage(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;grayscale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;        _&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;filter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;none&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The above code is compatible with the vast majority of browsers, including QQ Browser, 360 Speed Browser, Internet Explorer, and others.&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>前端</category><category>CSS</category><category>兼容性</category></item><item><title>Embedding the Chrome Offline Dinosaur Game in a Blog</title><link>https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/</guid><description>A guide to embedding the Chrome Offline Dinosaur Game in a Typecho blog, covering the general web page embedding method, iframe embed code, and usage notes.</description><pubDate>Tue, 31 Mar 2020 17:22:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Recently, while browsing other bloggers&apos; sites, I came across someone embedding Chrome&apos;s offline dinosaur game into their blog. I found it quite interesting and wanted to do the same. However, I found the original blog&apos;s implementation and source code rather rough, so I located the source code on GitHub and further refined it to make it easier to embed in a blog. Now let me walk through the steps.&lt;/p&gt;
&lt;p&gt;Come try mine first &lt;a href=&quot;https://www.xsy.fun/game.html&quot; title=&quot;Click to start playing&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;click here to start playing&lt;/a&gt;&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;main-text&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/#main-text&quot;&gt;Main Text&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First, the project source code is here: &lt;a href=&quot;https://github.com/xsy2004/chrome_dino_game&quot; title=&quot;Github&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;Github&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;general-web-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/#general-web-pages&quot;&gt;General Web Pages&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Usage is very simple. If you&apos;re using it on a regular web page, just add&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;container&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;runner.js&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; initRunner&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;#container&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;where &lt;code&gt;runner.js&lt;/code&gt; can be any address. You can place the runner locally, or store it on OSS (Alibaba Cloud Object Storage) or similar storage.&lt;/p&gt;
&lt;h3 id=&quot;typecho-blog&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/#typecho-blog&quot;&gt;Typecho Blog&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We can also embed this code into the blog. Of course, for convenience here, I directly use the iframe method to include it, which is simpler. Here is my approach:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;iframe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic&quot;&gt; align&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;center&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; width&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;100%&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; height&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;200px&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;https://cdn.xsiy.ltd/site/typecho/game/index.html&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;  frameborder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;no&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic&quot;&gt; border&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;  scrolling&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;no&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; marginwidth&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; marginheight&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; &gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;iframe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;It&apos;s very simple, just one line is enough. Of course, you can also choose the conventional way to embed it.&lt;/p&gt;
&lt;p&gt;My approach is to include the html file stored on my OSS (Alibaba Cloud Object Storage), so make sure your OSS (Alibaba Cloud Object Storage) lasts as long as your website does.&lt;/p&gt;
&lt;p&gt;The source code of index.html is as follows:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;!&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; html&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; lang&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;zh-CN&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    &amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;meta&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; charset&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    &amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;meta&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;viewport&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; content&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;    &amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;Runner&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;https://cdn.xsiy.ltd/site/typecho/game/runner.js&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;    initRunner&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;#test&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; );&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;You can store it on your own local server and reference it there. The same goes for the js.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;notes&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-31-jiang-chrome-li-xian-xiao-kong-long-qian-ru-bo-ke/#notes&quot;&gt;Notes&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The markdown syntax in Typecho &lt;code&gt;!!!你的代码!!!&lt;/code&gt; like this embeds code. Remember to use an English exclamation mark.&lt;/p&gt;
&lt;p&gt;Do not copy my code directly for use, because a Referer whitelist has been set up to prevent hotlinking, so using it directly will not work.&lt;/p&gt;
&lt;p&gt;This method supports playing on mobile phones, computers, and other devices.&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>前端</category><category>Typecho</category><category>博客</category><category>Markdown</category></item><item><title>Visual Studio Remote Development</title><link>https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/</guid><description>A guide to deploying code-server on Ubuntu and running it as a systemd daemon to set up a remote VS Code development environment.</description><pubDate>Mon, 02 Mar 2020 16:24:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Recently I built a remote development project &lt;code&gt;Visual Studio Code Remote Development&lt;/code&gt;. It moves the VS Code client to the cloud,&lt;/p&gt;
&lt;p&gt;letting you use a fully featured development environment inside containers, on remote devices, or even on the Linux subsystem for Windows (WSL).&lt;/p&gt;
&lt;h3 id=&quot;official-description&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#official-description&quot;&gt;Official description&lt;/a&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Develop on the same operating system you deploy to, or use bigger or more specialized hardware.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sandbox the development environment so it does not affect the configuration of your local machine.&lt;/p&gt;
&lt;p&gt;Make it easy for new contributors to get started, and keep everyone on a consistent environment.&lt;/p&gt;
&lt;p&gt;Use tools or runtimes that are unavailable on your local operating system, or manage multiple versions of them.&lt;/p&gt;
&lt;p&gt;Develop Linux-deployed applications using the Windows Subsystem for Linux.&lt;/p&gt;
&lt;p&gt;Access an existing development environment from multiple machines or locations.&lt;/p&gt;
&lt;p&gt;Debug applications running in other locations, such as a customer site or the cloud.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://code.visualstudio.com/assets/docs/remote/remote-overview/architecture.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;how-to-install&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#how-to-install&quot;&gt;How to install&lt;/a&gt;&lt;/h2&gt;
&lt;h4 id=&quot;system-requirements&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#system-requirements&quot;&gt;System requirements&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Local: a supported OpenSSH-compatible SSH client must also be installed.&lt;/p&gt;
&lt;h4 id=&quot;remote-ssh-host-an-ssh-server-running-on&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#remote-ssh-host-an-ssh-server-running-on&quot;&gt;Remote SSH host: an SSH server running on:&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;x86_64 Debian 8 and later, Ubuntu 16.04 and later, CentOS / RHEL 7 and later.&lt;/p&gt;
&lt;p&gt;ARMv7l (AArch32) Raspbian Stretch / 9+ (32-bit).&lt;/p&gt;
&lt;p&gt;ARMv8l (AArch64) Ubuntu 18.04+ (64-bit).&lt;/p&gt;
&lt;h4 id=&quot;experimental-ssh-host-support-vs-code-insiders-only&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#experimental-ssh-host-support-vs-code-insiders-only&quot;&gt;Experimental SSH host support (VS Code Insiders only):&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Windows 10 / Server 2016/2019 (1803+), using the official OpenSSH Server and enabling remote.SSH.useLocalServer in VS Code settings.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;ubuntu-1804&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#ubuntu-1804&quot;&gt;Ubuntu 18.04&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First, download the package from GitHub &lt;a href=&quot;https://github.com/cdr/code-server/releases&quot; title=&quot;Download link&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;download link&lt;/a&gt;&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;wget https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-x86_64.tar.gz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;tar xvzf code-server2.1698-vsc1.41.1-linux-x86_64.tar.gz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;cd code-server2.1698-vsc1.41.1-linux-x86_64&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;# 设置密码&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;export PASSWORD=password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;./code-server --auth password&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;process-daemon&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#process-daemon&quot;&gt;Process daemon&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;sudo nano /etc/systemd/system/code-server.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Add the following configuration:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;[Unit]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Description=Code Server IDE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;After=network.target&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;[Service]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Type=simple&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;User=root&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Restart=on-failure&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;RestartSec=10&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Environment=&quot;PASSWORD=password&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;ExecStart=/path/to/code-server --auth password &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;StandardOutput=file:/var/log/code-server-output.log&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;StandardError=file:/var/log/code-server-error.log&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;[Install]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;WantedBy=multi-user.target&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;start-the-service&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2020-03-02-visual-studio-yuan-cheng-kai-fa/#start-the-service&quot;&gt;Start the service&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;systemctl start code-server&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>linux</category><category>运维</category><category>网络</category></item><item><title>Dongting Lake Field Study – Day 3</title><link>https://blog.xsy.fun/en/posts/2019-11-15-dong-ting-hu-kao-cha-day-3/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-11-15-dong-ting-hu-kao-cha-day-3/</guid><description>A record of the third day of the Dongting Lake study trip, covering the finless porpoise boat tour, conversations with the director of the protection station, and the journey back.</description><pubDate>Sat, 16 Nov 2019 04:53:00 GMT</pubDate><content:encoded>&lt;p&gt;On the last day of the three-day study tour, we set off at 7:20 in the morning. After nearly two hours on the road, covering 90 kilometers, we arrived at the final stop of our journey: the Yangtze finless porpoise waterway protection station.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/cid163/1D7S%24U9Y%7E3KAU73J_SP51JX.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;After a brief rest, we began the river patrol. The whole class stood on the boat watching for any sign of finless porpoise activity. We not only saw porpoises leaping out of the water, but also saw rare birds soaring across the sky. It was, as the saying goes, a rich harvest.&lt;/p&gt;
&lt;p&gt;Standing at the bow, feeling the river wind blow across us, the water surging beneath our feet and waves constantly lapping against the hull, breathing in clean, unpolluted air, we came to realize from the bottom of our hearts how important environmental protection is. We also resolved to lead by example and consciously protect the ecological environment.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/cid163/EW%7DU%251A%25G2%40_4%40JU%24Q%7E_QDM.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;After the patrol, we were fortunate to meet the station director. As someone who has been on the front line of protecting the Yangtze&apos;s environment for many years, the director has very distinctive insights and profound knowledge about protecting the finless porpoise. So we asked several questions we had prepared for a long time, such as whether protecting the finless porpoise conflicts with economic development, and whether the finless porpoise can hybridize with related species, among others. The director answered our questions with great enthusiasm. His answers were unique and opened up new ways of thinking for us, and we benefited greatly.&lt;/p&gt;
&lt;p&gt;Before leaving, to commemorate this patrol activity, we took the initiative to ask the director for a group photo. He readily agreed, and took a remarkably meaningful photo with all of us students and our accompanying teachers.&lt;/p&gt;
&lt;p&gt;After leaving, we had lunch at a nearby restaurant, which marked the official end of the last activity. We then began the journey back to Changsha East high-speed railway station. After four hours by bus and two hours by train, we arrived safely back in Nanchang at 7:00, concluding the final day of our trip.&lt;/p&gt;
&lt;p&gt;Looking back on the three days, we were honored to see the finless porpoise, a creature we had never really known before. We got to know the study tour leader, Dao Ge, Director Li of the Elk Nature Reserve, Da Ming Ge, a civil conservationist of Dongting Lake, and Director Deng of the Hua Rong Chengjiang Ancient Yangtze Channel in Hunan. Thanks to them, we learned about the finless porpoise, the elk, and migratory birds from many angles. Over these three days of study, we came to understand how important it is to protect the finless porpoise. The seed of protecting the finless porpoise has taken root in our hearts, and improving the porpoise&apos;s living environment requires everyone to take action.&lt;/p&gt;
&lt;p&gt;Though the three-day study tour on the finless porpoise was short, these memories will last forever!&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>读书笔记</category><category>运维</category></item><item><title>Dongting Lake Field Trip – Day 2</title><link>https://blog.xsy.fun/en/posts/2019-11-14-dong-ting-hu-kao-cha-day-2/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-11-14-dong-ting-hu-kao-cha-day-2/</guid><description>A record of the second day of the 2019 Dongting Lake study trip, including the Yangtze finless porpoise observation, the benthic organism and water quality experiments, and the daily summary.</description><pubDate>Thu, 14 Nov 2019 21:14:00 GMT</pubDate><content:encoded>&lt;p&gt;On November 14, 2019, we arrived at Yueyang, Hunan, for the second day of our study tour. Here is Dongting Lake, the birthplace of traditional Chinese culture. Our group boarded a yacht to get close to the Yangtze finless porpoise, a Class I nationally protected animal.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid162/-4fb97907021e7194.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;The Yangtze finless porpoise is an endangered species in the world, and only about 300 remain in Dongting Lake. But under the protection of the goddess of luck, we were fortunate enough to see the porpoises and to record the moment they surfaced.&lt;/p&gt;
&lt;p&gt;On the yacht, with the sea breeze blowing, blue sky and white clouds overhead, we unexpectedly spotted two black arcs on the water. &quot;Those are porpoises!&quot; the classmates shouted with delight. In the instant the porpoises broke the surface, several classmates took out their cameras and captured their graceful posture.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid162/qq_pic_merged_1573745529532.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;On the small island where the lookout tower stands, the classmates met two &quot;guardians.&quot; They were two dogs adopted by the staff. While feeding them, several classmates, all for the great cause of &quot;study tour,&quot; sank into the marsh and sacrificed their shoes. After these small mishaps, we prepared to head back.&lt;/p&gt;
&lt;p&gt;Suddenly, a huge vessel appeared. Brother Dao said, &quot;Look over there. Ahead is probably illegal sand dredging. Sand dredging is strictly prohibited across the entire Dongting Lake waterway.&quot; Hearing this, we were indignant yet helpless. All we could do was report it to the relevant national authorities. But then I thought: the witness of the public is the best deterrent to illegal sand dredgers. Through us, they felt society&apos;s attention, and we truly contributed to the cause of protecting the porpoises!&lt;/p&gt;
&lt;p&gt;The sound of a siren rang out. We knew the maritime safety staff had arrived and believed the lawbreakers would be severely punished. However, the maritime staff explained to us: &quot;That is a dredging vessel with legal permits.&quot; We only held our cameras, said nothing, and quietly recorded this scene: sand shoveled up bucket by bucket, money banked bundle by bundle. All we could do was this.&lt;/p&gt;
&lt;p&gt;Human nature is complex, and merchants pursue profit. But the world is not always dark. That ray of light will be lit by us. In the darkness, we light a lamp to illuminate the darkness and warm people&apos;s hearts.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid162/220e8f7b8ff41454.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;After lunch we rested briefly, cleaned the mud off our shoes and clothes, and began the two experimental surveys of the afternoon.&lt;/p&gt;
&lt;p&gt;The first experiment was on benthic organisms. We used the professional instrument Mr. Liu brought along, the Peterson grab sampler. After we hauled up the bottom sediment, we went through layers of filtering and multiple procedures to screen out samples suitable for collecting organisms. Then we used tweezers to collect snails, freshwater snails, dragonfly larvae, and other organisms into bottles. In this way, we could judge whether the water quality was good based on the organisms collected.&lt;/p&gt;
&lt;p&gt;Through Mr. Liu&apos;s explanation, we learned that when dragonfly larvae appear in a body of water, it indicates good water quality, while leeches appearing indicates severe pollution. In the experiment, our group was lucky enough to collect dragonfly larvae, along with some shells and freshwater snails. This shows that the water quality of Dongting Lake is relatively good.&lt;/p&gt;
&lt;p&gt;The second experiment was to judge water quality by using pH test strips and data on ammonia nitrogen and potassium permanganate in the sample water. We compared samples from a sewage discharge point and from the lake&apos;s surface water, and found that the water at the sewage outlet was seriously polluted and far exceeded the standard. This shows that it is no wonder some factories cause such harm to the environment. Unfortunately, even though we discovered this problem, we could not stop the polluting behavior and could only return the samples to the lake.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid162/0s01032834384P91114-164110.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;After dinner, we drove back to the hotel and went to the second-floor conference room for the summary meeting of the day. First, Mr. Liu introduced the plan for tomorrow: visiting the Institute of Hydrobiology and the translocation protection area, and told us the goals and precautions for tomorrow. Then he summarized today&apos;s schedule. Through this meeting we realized that a study tour emphasizes &quot;study&quot; rather than &quot;tour.&quot; We must look through phenomena to the essential problems and offer suggestions on the corresponding issues. Finally, today&apos;s itinerary came to a close with a documentary Mr. Liu had made earlier, on his survey of the porpoises during the Yangtze River cruise.&lt;/p&gt;
&lt;p&gt;Tomorrow is both a new beginning and the day we return home. We will surely cherish the opportunity to visit the Institute, and we hope there will be no regrets tomorrow!&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>网络安全</category><category>运维</category><category>读书笔记</category></item><item><title>Dongting Lake Field Trip - Day 1</title><link>https://blog.xsy.fun/en/posts/2019-11-13-dong-ting-hu-kao-cha-day-1/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-11-13-dong-ting-hu-kao-cha-day-1/</guid><description>A record of the first day of a finless porpoise research survey conducted by high school students from Nanchang in Yueyang, Hunan, including a visit to the Milu nature reserve and birdwatching at Dongting Lake&apos;s migratory bird habitats.</description><pubDate>Wed, 13 Nov 2019 18:26:00 GMT</pubDate><content:encoded>&lt;p&gt;On November 13 at 10:08 a.m., the high school international class students of Nanchang Xinyuan School set out from Nanchang for a three-day dolphin research and investigation trip to Yueyang, Hunan. The first day of the activity concluded successfully. The dynamic report is as follows:&lt;/p&gt;
&lt;p&gt;After a two-hour drive in the morning, we arrived at Changsha East Railway Station. After a short rest, we set off again for Yueyang and arrived at 12:56 p.m. After lunch, we followed Teacher Liu to the milu nature reserve managed by Station Master Li, where we observed at close range the national first-class protected animal, the Père David&apos;s deer (milu), named Dian Dian.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid160/_1397309447_DSCF8077_1573652006000_xg_0.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;We actively asked Station Master Li about the morphological characteristics, habitat, living habits, distribution range, reproductive methods, and the current status of the species of milu, and Station Master Li responded to us enthusiastically.&lt;/p&gt;
&lt;p&gt;We not only learned specific information about milu, but every one of our classmates also personally fed food to Dian Dian under Station Master Li&apos;s guidance.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid160/mmexport1573651769998.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;Through our investigation and research from first-hand experience, we felt Station Master Li&apos;s perseverance and determination in protecting wildlife and the natural environment. This made us resolve to learn from Station Master Li, take him as a role model, and build awareness of protecting wildlife.&lt;/p&gt;
&lt;p&gt;Before leaving, we took the initiative to ask Station Master Li for a group photo. Station Master Li readily agreed, so we took a large group photo with him and Dian Dian as a souvenir and memory of this research trip.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid160/mmexport1573652297114.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;After concluding our investigation of Dian Dian, we drove to the East Dongting Lake Nature Reserve.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid160/%7DQL0J67T9%5BPA5ZI%25W%5DK22U2.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;At the Wetland Biological Science Museum of the East Dongting Lake National Nature Reserve, we watched a documentary on protecting the Dongting Lake environment. Lines in the documentary such as &quot;it supports the water use of all of Hunan and once turned countless Yangtze floods into harmless events&quot; and &quot;Dongting Lake is named for its water and flourishes because of its birds&quot; helped us more deeply appreciate the importance of Dongting Lake. We also saw eight categories of real specimens, including birds, wild plants, freshwater fish, and finless porpoises.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid160/mmexport1573651768653.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;Under Teacher Liu&apos;s guidance, we used professional telescopes to observe migratory birds such as geese and ducks. On Caisang Lake, a flock of ducks was relaxing and playing on the water. Teacher Liu told us that identifying migratory bird species involves three steps: first look at the beak, then the legs, and finally the plumage. We also learned that some tourists, in order to take beautiful photos, forced migratory birds to fly up, which injured their wings. We realized that observing migratory birds requires not only looking at their appearance and identifying their species, but also learning to protect their environment and habits, and trying not to disturb their lives while observing them. After dinner, we concluded the first day&apos;s itinerary.&lt;/p&gt;
&lt;p&gt;This day brought unfamiliar experiences, surprises, and some disappointments. We learned a great deal and also realized that our every action affects the environment. As night falls, we look forward to the Dongting Lake finless porpoise journey tomorrow, and hope for even more new discoveries!&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>读书笔记</category><category>写作</category></item><item><title>Life Before the Zhongkao</title><link>https://blog.xsy.fun/en/posts/2019-06-19-zhong-kao-qian-de-sheng-huo/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-06-19-zhong-kao-qian-de-sheng-huo/</guid><description>The author records their experience of tutoring in the ten days before the Zhongkao (high school entrance exam), their mindset after the exam, and, along the way, a small project of fitting a cooling modification to the home router.</description><pubDate>Wed, 19 Jun 2019 19:41:00 GMT</pubDate><content:encoded>&lt;p&gt;Now that I&apos;m finished as of noon, the only thing still limiting me is the Constitution of the People&apos;s Republic of China. Finishing the exams really does feel great, and now I finally have time to write this post. Let me start with the time before the exams. Those days were brutal. For the ten days before the exam I stopped going to school and went to a tutoring center to cram physics, chemistry, and English. Those ten days were really miserable, but I did give it everything, I suppose. I imagine this is how top students spend every weekend. Thinking about that, I feel a bit ashamed. If you don&apos;t work hard normally, you can only cram at the last minute.&lt;/p&gt;
&lt;p&gt;Let me describe how I spent these ten days. Every day had courses that were no less intense than regular school classes. From 8 to 10 in the morning was English, then physics, then chemistry from 2 to 4 in the afternoon, and after that I&apos;d do practice papers, usually two physics papers and one chemistry paper, plus English listening and reading comprehension. That was the daily training load. In the end, the conversion was weakest for English, and chemistry went up about 20 points. You can imagine how poor my earlier scores were. Physics went up about 10 points. Sometimes you don&apos;t know what you&apos;re capable of until you push yourself. Maybe this is what &quot;bitterness before sweetness&quot; means! Although these ten days were exhausting, I experienced the joy that working people feel when they reap the rewards of their labor. I can only say it felt wonderful. People need to set goals for themselves, but I tend to prefer carrying things out rather than directing them, so I don&apos;t really set goals for myself.&lt;/p&gt;
&lt;p&gt;Even though it was only ten days, a lot happened. The first day still felt fresh, but after the second day there was only pain. So I often went up to the rooftop alone to clear my head, and that feeling was really nice.&lt;/p&gt;
&lt;p&gt;It seems that in the end I also had a bit of a clash with a teacher. That&apos;s fine, though. After this time I won&apos;t see her again. How should I put it? Some people think I&apos;m a bit stubborn. Thinking about it carefully, maybe I am a little, but I&apos;m only stubborn about things I firmly believe in, and I don&apos;t think I did anything wrong. For example, if someone tries to grab my snacks, I won&apos;t give them up even if I have to throw them away, but if they ask politely, I will give them some (except of course for people I&apos;m close to). After all, taking someone&apos;s property infringes on a citizen&apos;s property rights, right? So I don&apos;t think I did anything wrong. If anything, his behavior violated my property rights.&lt;/p&gt;
&lt;p&gt;I also really hate being threatened. If someone pointed a knife at me and wanted to stab me, I would fight back without hesitation. That&apos;s probably a human instinct. But in everyday life, if someone threatens me, I will definitely get back at them, and I&apos;ll do it quietly. I&apos;ll keep a smile on my face toward my enemy while stabbing them in the back. I think that&apos;s the best way, since after all, a gentleman handles things with dignity, right?&lt;/p&gt;
&lt;p&gt;This post is a bit scattered. I basically wrote whatever came to mind. Sorry about that!&lt;/p&gt;
&lt;p&gt;Recently I also did something else. My brother came to my house recently and complained that he kept getting 460 ms of ping when playing games. I figured it must be the mesh router&apos;s fault, so I listed my router on Xianyu for over 400 yuan, then spent 300 yuan on a Phicomm K3 and a heat-dissipation mod kit.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid158/IMG_20190618_201209.jpg&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;Here&apos;s the finished product! It should have lowered the temperature by more than 10 degrees, and the effect is pretty obvious! But I still need to wait for my brother to come over and test it for real. Not that I play games myself (mutters quietly).&lt;/p&gt;
&lt;p&gt;I&apos;ve also filmed a few videos. Nobody watches them, but I think I should keep going, since it&apos;s a hobby I love. So I&apos;ll probably post a lot of videos during this vacation. There will be far fewer technical things, and most of them will be real-life documentary videos. The vacation came too fast and feels a little unreal. Soon I&apos;ll be entering a completely new environment, high school, and I can&apos;t help feeling a little lost. I&apos;m used to this road from home to school!&lt;/p&gt;
&lt;p&gt;But people have to learn to step outside their comfort zone and change things. I&apos;m an optimist by nature (maybe because I&apos;ve been through too many bad experiences). So a new environment means new teachers and new classmates, and I&apos;ll meet better people too. I also hope that on this new journey I can do more, have more fun, and, most importantly, study harder!&lt;/p&gt;
&lt;p&gt;I don&apos;t really have anything else to write. That&apos;s it for now. Thanks for reading all of my rambling.&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>写作</category><category>运维</category><category>网络</category></item><item><title>Installing ImgURL Image Hosting</title><link>https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/</guid><description>An introduction to the features, environment requirements, Nginx rewrite configuration, and installation steps for setting up a self-hosted ImgURL image hosting service under the BT Panel (Baota).</description><pubDate>Sat, 27 Apr 2019 12:46:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The previous article covered solutions for Sina image hosting failures. But our many bloggers were unwilling to remain constrained by Sina and at the mercy of its whims, which affected their blogs. So this article was written specifically to keep bloggers&apos; image assets safe!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ImgURL is a simple, pure image hosting program, developed with PHP + SQLite 3.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid155/68747470733a2f2f692e626d702e6f76682f696d67732f323031382f31322f303663663061633362373632356236622e706e67.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid155/68747470733a2f2f692e626d702e6f76682f696d67732f323031382f31322f663062353635653265306666613136362e706e67.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid155/68747470733a2f2f692e626d702e6f76682f696d67732f323031382f31322f303137633565363662353364623464312e706e67.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;h3 id=&quot;key-features&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#key-features&quot;&gt;Key Features&lt;/a&gt;&lt;/h3&gt;
&lt;ul class=&quot;contains-task-list&quot;&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked disabled&gt; Supports drag-and-drop upload, multi-image upload, Ctrl + V paste upload, and URL upload&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked disabled&gt; Supports image cropping and automatic thumbnail generation&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked disabled&gt; Limits the number of uploads by visitors&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked disabled&gt; Image compression / batch compression&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked disabled&gt; Image adult-content detection / batch detection&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked disabled&gt; API support&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; disabled&gt; Online update&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; disabled&gt; External storage&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;environment-requirements&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#environment-requirements&quot;&gt;Environment Requirements&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;PHP &gt;= 5.6&lt;/li&gt;
&lt;li&gt;PDO_SQLite&lt;/li&gt;
&lt;li&gt;GD2&lt;/li&gt;
&lt;li&gt;ImageMagick&lt;/li&gt;
&lt;li&gt;fileinfo&lt;/li&gt;
&lt;li&gt;pathinfo&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;main-content&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#main-content&quot;&gt;Main Content&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Without further ado, let&apos;s get started.&lt;/p&gt;
&lt;h3 id=&quot;configuring-pseudo-static-rewrites&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#configuring-pseudo-static-rewrites&quot;&gt;Configuring Pseudo-Static Rewrites&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Nginx&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;location / {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;try_files $uri $uri/ /index.php?$query_string;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;location ~* \.(db3|json)$ {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  deny all;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;location ~* ^/(temp|upload|imgs|data|application|static|system)/.*.(php|php5)$ {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    return 403;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Add the above rules into the Nginx server block, and don&apos;t forget to reload Nginx once.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Apache&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;.htaccess&lt;/strong&gt; rules are included by default, so no setup is needed.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#installation&quot;&gt;Installation&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Visit &lt;a href=&quot;https://github.com/helloxz/imgurl/releases&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;https://github.com/helloxz/imgurl/releases&lt;/a&gt; to download the latest source code, and extract it to the site root directory. (Mind the directory permissions, mind the directory permissions, mind the directory permissions.)&lt;/p&gt;
&lt;p&gt;Visit your domain &lt;code&gt;http(s)://domain.com/install/?setup=1&lt;/code&gt; and follow the prompts to install. If the environment check fails, please resolve the environment issues yourself.&lt;/p&gt;
&lt;h3 id=&quot;installing-fileinfo--imagemagick&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#installing-fileinfo--imagemagick&quot;&gt;Installing fileinfo &amp;#x26; ImageMagick&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you have not installed them, read on.&lt;/p&gt;
&lt;p&gt;(The demonstrations all use the BT Panel.)&lt;/p&gt;
&lt;p&gt;In the BT Panel backend - Software Management - find the PHP version for your site - Settings for PHP - Install Extensions - tick fileinfo and imagemagick, as shown in the screenshot below.&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid155/snipaste_20190109_185759.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;p&gt;PS: ImageMagick is not mandatory. This operation requires your ImgURL version to be v2.1 or above.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;final-words&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-imgurl-tu-chuang-de-an-zhuang/#final-words&quot;&gt;Final Words&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Wishing you a pleasant experience. Hehe, do share generously!&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>运维</category><category>PHP</category><category>Nginx</category><category>Markdown</category></item><item><title>Solutions for Sina Image Hosting Failure</title><link>https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/</guid><description>An introduction to several solutions for bypassing verification after Sina image hosting stopped working due to Referer hotlink protection, including PHP relay and meta tag methods.</description><pubDate>Sat, 27 Apr 2019 12:31:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;foreword&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#foreword&quot;&gt;Foreword&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Recently, Sina Cloud added Referer anti-hotlinking verification to its image hosting service, which broke the referenced images in many bloggers&apos; articles that use Sina as their image host, so they can no longer be displayed. To work around this, we can bypass the Referer anti-hotlinking check through relaying or spoofing.&lt;/p&gt;
&lt;h3 id=&quot;what-is-referer-anti-hotlinking&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#what-is-referer-anti-hotlinking&quot;&gt;What is Referer anti-hotlinking&lt;/a&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The HTTP Referer is part of the header. When a browser sends a request to a web server, it usually includes the Referer, telling the server which page the request was linked from. The server can use this information for processing. For example, if you link to a friend&apos;s site from your homepage, your friend&apos;s server can count from the HTTP Referer how many users click the link on your homepage each day to visit their site.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Based on the Referer, the server side can tell which requests come from &quot;allies&quot; and which come from external links, thereby filtering requests and saving server resources.&lt;/p&gt;
&lt;p&gt;Our solution is to access resources without sending a Referer, so we need to disguise or relay the request. Without further ado, here are the solutions.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;solutions&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#solutions&quot;&gt;Solutions&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;php-file-relay&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#php-file-relay&quot;&gt;PHP File Relay&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;php&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;php&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;&amp;#x3C;?&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;php&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;Content-type: image/jpeg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; file_get_contents&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;isset&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($_GET[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;url&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$_GET[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;url&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Principle: Pass in the URL and then output the image to display it.&lt;/p&gt;
&lt;p&gt;Pros and cons: &lt;strong&gt;Statistics components can be used&lt;/strong&gt;, but efficiency is low, and it requires replacing links in bulk.&lt;/p&gt;
&lt;p&gt;Usage: Create a PHP file on a server.&lt;/p&gt;
&lt;p&gt;http(s)://your-domain/img.php?url=image-address&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;php&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;php&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;https://your-domain-name/img.php?url=https://ws3.sinaimg.cn/large/006tNbRwly1fyq4yujgssj30jg0jgmxg.jpg&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; /&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;(Verified to work)&lt;/p&gt;
&lt;h3 id=&quot;using-iframe&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#using-iframe&quot;&gt;Using iframe&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;window.sc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&amp;#x3C;img src=&apos;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/%E5%9B%BE%E7%89%87%E9%93%BE%E6%8E%A5?%22%3C/span%3E%3Cspan%20style=%22--shiki-light:#D73A49;--shiki-dark:#F97583%22%3E+%3C/span%3E%3Cspan%20style=%22--shiki-light:#24292E;--shiki-dark:#E1E4E8%22%3EMath.%3C/span%3E%3Cspan%20style=%22--shiki-light:#6F42C1;--shiki-dark:#B392F0%22%3Erandom%3C/span%3E%3Cspan%20style=%22--shiki-light:#24292E;--shiki-dark:#E1E4E8%22%3E()%3C/span%3E%3Cspan%20style=%22--shiki-light:#D73A49;--shiki-dark:#F97583%22%3E+%3C/span%3E%3Cspan%20style=%22--shiki-light:#032F62;--shiki-dark:#9ECBFF%22%3E%22&apos;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;iframe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;imiframe&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;javascript:parent.sc&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; style&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;border:none; overflow: hidden;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; scrolling&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;no&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; frameborder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; onload&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;javascript&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; x&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;(&apos;imiframe&apos;).&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;contentWindow&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;images&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;];&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;width&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;width&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;iframe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Principle: Reference through an iframe.&lt;/p&gt;
&lt;p&gt;Pros and cons: Slow, meh.&lt;/p&gt;
&lt;p&gt;(Not verified)&lt;/p&gt;
&lt;h3 id=&quot;curl&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#curl&quot;&gt;Curl&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;php&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;php&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;&amp;#x3C;?&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;php&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$url &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; $_GET[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;url&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;];  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$dir &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; pathinfo&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($url);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$host &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; $dir[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;dirname&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;];  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$refer &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; $host&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$ch &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; curl_init&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($url);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;curl_setopt&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; ($ch, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;CURLOPT_REFERER&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, $refer);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;curl_setopt&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($ch, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6A737D;--shiki-dark:#6A737D&quot;&gt;//激活可修改页面,Activation can modify the page  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;curl_setopt&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($ch, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;curl_setopt&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($ch, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;CURLOPT_BINARYTRANSFER&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$data &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; curl_exec&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($ch);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;curl_close&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($ch);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$ext &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; strtolower&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;substr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;strrchr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;($img,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;.&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;));  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$types &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; array&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;            &apos;gif&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;image/gif&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;            &apos;jpeg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;image/jpeg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;            &apos;jpg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;image/jpeg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;            &apos;jpe&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;image/jpeg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;            &apos;png&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&apos;image/png&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;,  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$type &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; $types[$ext] &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; $types[$ext] &lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt; &apos;image/jpeg&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;Content-type: &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;$type);  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt; $data;   &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Principle: Do not send the Referer.&lt;/p&gt;
&lt;p&gt;Pros and cons: &lt;strong&gt;Statistics components can be used&lt;/strong&gt;, but slow, and it requires replacing links in bulk.&lt;/p&gt;
&lt;p&gt;Usage: Create a PHP file on a server.&lt;/p&gt;
&lt;p&gt;http(s)://your-domain/img.php?url=image-address&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;php&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;php&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;--shiki-light:#005CC5;--shiki-dark:#79B8FF&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;https://your-domain-name/img.php?url=https://ws3.sinaimg.cn/large/006tNbRwly1fyq4yujgssj30jg0jgmxg.jpg&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D73A49;--shiki-dark:#F97583&quot;&gt; /&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;(Verified to work)&lt;/p&gt;
&lt;h3 id=&quot;meta-tag&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#meta-tag&quot;&gt;Meta Tag&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;meta&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;referrer&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; content&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;never&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Principle:&lt;/strong&gt; Do not send the Referer by specifying a meta tag with name set to referrer.&lt;/p&gt;
&lt;p&gt;Pros and cons: Statistics components cannot be used, because statistics also rely on this mechanism.&lt;/p&gt;
&lt;p&gt;(Not verified)&lt;/p&gt;
&lt;h3 id=&quot;csp-response-header&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#csp-response-header&quot;&gt;CSP Response Header&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;meta&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; http-equiv&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;Content-Security-Policy&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; content&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;referrer&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Principle:&lt;/strong&gt; CSP (Content Security Policy) is a specification related to page content security. Over HTTP, the Content-Security-Policy field in the response header tells the browser which CSP policy the current page should use.&lt;/p&gt;
&lt;p&gt;(Not verified)&lt;/p&gt;
&lt;h3 id=&quot;referer-attribute-on-a--tags&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#referer-attribute-on-a--tags&quot;&gt;Referer Attribute on &lt;code&gt;&amp;#x3C;a&gt; &lt;/code&gt; Tags&lt;/a&gt;&lt;/h3&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;html&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;html&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; href&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;https://www.xsy.fun&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#6F42C1;--shiki-dark:#B392F0&quot;&gt; referrer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#032F62;--shiki-dark:#9ECBFF&quot;&gt;&quot;no-referrer&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;XSY的FUN天地&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#22863A;--shiki-dark:#85E89D&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--shiki-light:#24292E;--shiki-dark:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Principle:&lt;/strong&gt; Add a no-referrer policy to the &lt;code&gt;&amp;#x3C;a&gt; &lt;/code&gt; tag.&lt;/p&gt;
&lt;p&gt;Pros and cons: This method only affects this single link.&lt;/p&gt;
&lt;p&gt;In addition, only three Referrer policies are available for &lt;code&gt;&amp;#x3C;a&gt; &lt;/code&gt; tags: no-referrer, origin, and unsafe-url.&lt;/p&gt;
&lt;p&gt;Also, a policy set on an individual link takes precedence over CSP.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;emmm&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-04-27-xin-lang-tu-chuang-shi-xiao-jie-jue-fang-an/#emmm&quot;&gt;Emmm&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The best approach is to build your own image host or use object storage.&lt;/p&gt;
&lt;p&gt;I recommend Alibaba Cloud OSS: low cost and fast, and it supports global acceleration via CDN (charged separately).&lt;/p&gt;
&lt;p&gt;Cloud product universal red envelope: &lt;a href=&quot;https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=w7yzqy3r&quot; title=&quot;Click here&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;click here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also, &lt;strong&gt;migration solutions&lt;/strong&gt; have already been shared by experts.&lt;/p&gt;
&lt;p&gt;See GitHub: &lt;a href=&quot;https://github.com/ihewro/PullSinaimgtoTypecho&quot; title=&quot;Link&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>网络安全</category><category>Typecho</category><category>数据迁移</category><category>前端</category></item><item><title>Just 3 Lines of Code to Make Thunder Ignore &quot;Download Unavailable Due to a Copyright Holder&apos;s Request&quot;</title><link>https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/</guid><description>Steps for blocking some of Thunder&apos;s domains by modifying the Windows hosts file, bypassing the copyright restriction prompt.</description><pubDate>Thu, 28 Mar 2019 18:12:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Wow, it&apos;s been a long time since I last wrote a post. I&apos;ve been really busy lately, with homework and everything. This test environment is limited to Thunder Speed Edition (迅雷极速版); it is not guaranteed to work with all clients.&lt;/p&gt;
&lt;p&gt;If that really doesn&apos;t work, just use Thunder 5 instead. No files need to be modified, you can use it directly, and there are no copyright restrictions.&lt;/p&gt;
&lt;p&gt;In fact, the process is quite simple: just modify the hosts file directly.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;tutorial&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#tutorial&quot;&gt;Tutorial&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;step-1&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#step-1&quot;&gt;Step 1&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Open the hosts file. The specific file location:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;C:\Windows\System32\drivers\etc\hosts&lt;/code&gt;&lt;/p&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid132/1.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;h3 id=&quot;step-2&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#step-2&quot;&gt;Step 2&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Right-click the hosts file, and choose &lt;code&gt;记事本&lt;/code&gt; to open it.&lt;/p&gt;
&lt;h3 id=&quot;step-3&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#step-3&quot;&gt;Step 3&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Don&apos;t change anything inside. Just add the following three lines of code at the very bottom, then save.&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;127.0.0.1 hub5btmain.sandai.net &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;127.0.0.1 hub5emu.sandai.net &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;127.0.0.1 upgrade.xl9.xunlei.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;figure class=&quot;post-figure&quot;&gt;&lt;img src=&quot;https://cdn.xsiy.ltd/photo/pid132/2.png&quot; alt=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/figure&gt;
&lt;h3 id=&quot;step-4&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#step-4&quot;&gt;Step 4&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Refresh DNS (don&apos;t type the corner quotation marks below)&lt;/p&gt;
&lt;p&gt;Press the shortcut key &lt;code&gt;Win + R&lt;/code&gt; to open the Run dialog, type &quot;cmd&quot;, and click OK to open the command prompt window.&lt;/p&gt;
&lt;p&gt;In the command line window, type &lt;code&gt;ipconfig /flushdns&lt;/code&gt; and press Enter to refresh the local DNS cache data.&lt;/p&gt;
&lt;h3 id=&quot;ps&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-03-28-jin-xu-3-xing-dai-ma-rang-xun-lei-wu-shi-ying-ban-quan-fang-yao-qiu-wu-fa-xia-zai/#ps&quot;&gt;PS&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If it says administrator permission is required, move the file to the desktop, modify and save it there, then drag it back. That&apos;s all!&lt;/p&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>网络</category><category>网络安全</category><category>运维</category></item><item><title>The blog has been running for one year!</title><link>https://blog.xsy.fun/en/posts/2019-03-25-bo-ke-yun-xing-yi-zhou-nian-la/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-03-25-bo-ke-yun-xing-yi-zhou-nian-la/</guid><description>The author wrote a short commemorative post marking one full year of stable operation of the personal blog, and published a belated anniversary note.</description><pubDate>Mon, 25 Mar 2019 17:11:00 GMT</pubDate><content:encoded>&lt;p&gt;Congratulations on the blog running stably for one year (I forgot to post this yesterday)&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>博客</category><category>写作</category></item><item><title>Uninstalling Alibaba Cloud Monitoring and Blocking Cloud Shield IPs</title><link>https://blog.xsy.fun/en/posts/2019-02-07-xie-zai-a-li-yun-jian-kong-ji-ping-bi-yun-dun-ip/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2019-02-07-xie-zai-a-li-yun-jian-kong-ji-ping-bi-yun-dun-ip/</guid><description>How to uninstall Alibaba Cloud Shield (Aegis) and its leftover files, and block the Cloud Shield vulnerability scanner IPs via iptables.</description><pubDate>Thu, 07 Feb 2019 12:46:00 GMT</pubDate><content:encoded>&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;preface&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-02-07-xie-zai-a-li-yun-jian-kong-ji-ping-bi-yun-dun-ip/#preface&quot;&gt;Preface&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I&apos;m sure you&apos;ve all noticed that after booting a cloud server bought from Alibaba Cloud, the processes include AliYunDun, aliyun-service, and AliYunDunUpdate.&lt;/p&gt;
&lt;p&gt;These are actually Alibaba Cloud Security (Aegis, 安骑士). They monitor whether the cloud server is secure, can automatically scan for and kill viruses, and can also detect whether the server is running prohibited processes. As for the &quot;Cloud Shield IP&quot; — it is a vulnerability scanner from Alibaba Cloud, mainly used to check whether your server has known vulnerabilities. Alibaba Cloud Security (Aegis) has its benefits and drawbacks. The benefit is that it guarantees your server&apos;s security to some extent (though probably not by much). The drawback is that it monitors your cloud server around the clock, so you have essentially no privacy at all — it not only monitors for viruses but also monitors the content you store.&lt;/p&gt;
&lt;p&gt;So uninstall the built-in Alibaba Cloud Security (Aegis)! The method is simple: just run the following three commands.&lt;/p&gt;
&lt;/section&gt;&lt;section class=&quot;post-section&quot;&gt;&lt;h2 id=&quot;commands&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;https://blog.xsy.fun/en/posts/2019-02-07-xie-zai-a-li-yun-jian-kong-ji-ping-bi-yun-dun-ip/#commands&quot;&gt;Commands&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Uninstall Aegis:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;wget http://update.aegis.aliyun.com/download/uninstall.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;chmod +x uninstall.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;./uninstall.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;wget http://update.aegis.aliyun.com/download/quartz_uninstall.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;chmod +x quartz_uninstall.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;./quartz_uninstall.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Delete leftover files:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;pkill aliyun-service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;rm -rf /usr/local/aegis*&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Block the Cloud Shield IP:&lt;/p&gt;
&lt;figure class=&quot;code-block&quot; data-lang=&quot;text&quot;&gt;&lt;div class=&quot;code-block__bar&quot;&gt;&lt;span class=&quot;code-block__lang&quot;&gt;text&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.201.0/28 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.201.16/29 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.201.32/28 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.192/29 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.200/30 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.184/29 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.183/32 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.206/32 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.205/32 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.195/32 -j DROP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;iptables -I INPUT -s 140.205.225.204/32 -j DROP&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/section&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>运维</category><category>linux</category><category>网络安全</category><category>iptables</category></item><item><title>Zhongkao (High School Entrance Exam)</title><link>https://blog.xsy.fun/en/posts/2018-12-21-zhong-kao/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2018-12-21-zhong-kao/</guid><description>Since the high school entrance exam is approaching, the blogger has no time to deal with the many issues on the blog for the moment, and apologizes to readers.</description><pubDate>Fri, 21 Dec 2018 18:34:00 GMT</pubDate><content:encoded>&lt;p&gt;The blogger is about to take the high school entrance exam (zhongkao), so many issues on the blog have not been dealt with yet. Sorry for the inconvenience.&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>写作</category><category>博客</category></item><item><title>Clean Mobile WPS</title><link>https://blog.xsy.fun/en/posts/2018-11-11-chun-jing-ban-shou-ji-wps/</link><guid isPermaLink="true">https://blog.xsy.fun/en/posts/2018-11-11-chun-jing-ban-shou-ji-wps/</guid><description>Shares a clean, ad-free WPS installation package extracted from a phone&apos;s preinstalled system, and reminds you to uninstall the original version before installing it.</description><pubDate>Sun, 11 Nov 2018 14:17:00 GMT</pubDate><content:encoded>&lt;p&gt;I extracted the HTC custom-ROM version of WPS from a certain &quot;ham sausage&quot; phone. It&apos;s clean and ad-free. Remember to uninstall the original before installing it!&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://cdn.xsiy.ltd/share/hTC&quot; rel=&quot;noopener noreferrer nofollow&quot; target=&quot;_blank&quot;&gt;https://cdn.xsiy.ltd/share/hTC&lt;/a&gt; 预装版WPS.apk&lt;/p&gt;</content:encoded><dc:creator>Linus Xiong</dc:creator><category>兼容性</category><category>运维</category></item></channel></rss>