# Locally Lipschitz and Lipschitz continuous on compact sets are equivalent

By Wikipedia's definition, a mapping $f:X\mapsto Y$ ($X,Y$ are metric spaces) is locally Lipschitz if for every $x\in X$ there exists a neighborhood $U$ of $x$ such that $f$ restricted to $U$ is Lipschitz. It further claims that if $X$ is locally compact, then $f$ is locally Lipschitz $\Leftrightarrow$ $f$ is Lipschitz on every compact subset of $X$.

I understand that $\Leftarrow$ is clear, but I'm not sure why is $\Rightarrow$ true. For example, what if the compact subset $K$ is not path-connected?

Assume that it were not, then there is some compact subset $K$ of $X$ such that for every $n$, there exist points $x_{n},y_{n}\in X$ such that $d(f(x_{n}),f(y_{n}))>nd(x_{n},y_{n})$.
We invoke the sequential compactness, without loss of generality, we assume that $x_{n}\rightarrow x$, $y_{n}\rightarrow y$, where $x,y\in K$. Assume that $d(x,y)\ne 0$, then $d(x_{n},y_{n})>d(x,y)/2$ for large $n$, then $d(f(x_{n}),f(y_{n}))>nd(x,y)/2$, but $nd(x,y)/2\leq d(f(x_{n}),f(y_{n}))\leq\text{diam} f(K)<\infty$ for all such $n$, an impossibility.
We must have $d(x,y)=0$, then for some open set $G_{x}$ that containing $x$ such that $f$ is Lipschitz on $G_{x}$, say, $d(f(u),f(v))\leq Md(u,v)$ for all $u,v\in G_{x}$. Choose large $n_{0}$ such that $d(x_{n},y_{n})\leq d(x_{n},x)+d(y_{n},x)$ is small enough such that $x_{n},y_{n}\in G_{x}$ for all $n\geq n_{0}$, but then $Md(x_{n},y_{n})\geq d(f(x_{n}),f(y_{n}))>nd(x_{n},y_{n})$ for all $n\geq n_{0}$, this is also an impossibility.